Skip to content

Markdown Transform v0.10.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@jeromesimeon jeromesimeon released this 18 Feb 15:32

馃挜 This is a breaking change release, with changes to how conditional variables in CiceroMark are represented, and removing dependency on the Slate package. Please consult the notes below for how to migrate to this version from version 0.9.x or earlier.

CiceroMark

#162 : Changes the markdown and CiceroMark DOM for conditional variables

If you use markdown with ciceromark variables, you will have to change your document to include new fields in the <if .../> inlines for conditional variables. That HTML inline should now include two new attributes whenTrue and whenFalse containing the text for both when the condition is true and false. That text should be consistent with the one in the value attribute.

For instance, instead of:

<if id="forceMajeure" value="%20except%20for%20Force%20Majeure%20cases%2C" />
<if id="forceMajeure" value="" />

You should use:

<if id="forceMajeure" value="%20except%20for%20Force%20Majeure%20cases%2C" whenTrue="%20except%20for%20Force%20Majeure%20cases%2C" whenFalse=""/>
<if id="forceMajeure" value="" whenTrue="%20except%20for%20Force%20Majeure%20cases%2C" whenFalse=""/>

Slate

#175 #181 Slate is no longer a dependency for the markdown-slate package, but operates on the JSON representation for the Slate document object model instead.

If your code relies on the following calls in the markdown-transform package, you will have to pass JSON instead of a Slate value or transform the JSON back into a Slate value in your code:

  • SlateTransformer.toCiceroMark() and SlateTransformer.toCommonMark() now expect a Slate JSON representation rather than a Slate value.
  • SlateTransformer.fromCiceroMark() and SlateTransformer.fromCommonMark() now return a Slate JSON representation rather than a Slate value.

In your code, you can use the following to convert between Slate values and JSON:

const Value = require('slate').Value;
Value.fromJSON(json); // to go from JSON to Slate value
Value.toJSON(value); // to go from Slate value to JSON