Converts markdown text to/from a DOM.
To transform markdown text, first install the
npm install @accordproject/markdown-common --save
const CommonMarkTransformer = CommonMarkTransformer;const transformer = tagInfo : true ;const json = transformer;console;
The output should be:
Please refer to the schema for the details of all the the nodes that you should expect in the DOM.
You can then manipulate the DOM object, making any required changes:
jsonnodes0nodes0text = 'My New Heading';
Finally converting the DOM back into a markdown string:
const newMarkdown = commonMark;console;
The new markdown string will be:
My New Heading====This is some `code`.Fin.
Note how the original H1 heading has been normalized during conversion from
====syntax. In commonmark these are equivalent.
Accord Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.
© 2017-2019 Clause, Inc.