Skip to content

adobe/helix-md2jcr

Helix Markdown to JCR

A library that converts markdown to JCR.

Status

codecov GitHub license GitHub issues semantic-release

Development

Install all dependencies by running:

npm install

Usage

You can install the package via npm:

npm install @adobe/helix-md2jcr

Converting Markdown to JCR Nodes

Running the following command will generate an XML file with the JCR structure alongside of the input file.

For example generating xml for the simple.md file, run:

node ./src/cli/convert2jcr.js test/fixtures/simple.md 

If you wish to see the output in the console, you can run the following command with the verbose flag -v

node ./src/cli/convert2jcr.js test/fixtures/simple.md -v

If you wish to see the decoded output in the console you can run the following command with the verbose and decode flags -v and -d:

node ./src/cli/convert2jcr.js test/fixtures/simple.md -v -d

The converter will produce a .xml which is the generated document converted from markdown. This can be used to check for potential content changes due to conversion.

Baseline XML Files

Running the ./baseline-tests.sh script will detect any md file under test/fixtures and execute the convert2jcr node script.
The script will generate new xml files beside the md files it locates. This is helpful when making changes to the converter and you want to see if the changes have any impact on the output. By using git diff, you will see the new changes in the xml files. If you are satisfied with the changes, you can commit the new xml files.

Running Tests

Simply execute the following command to run the tests:

npm test