Navigator Prefabricating Marinates
Miss any of our Open RFC calls?Watch the recordings here! »

@accordproject/markdown-transform

0.12.11 • Public • Published

Markdown Transform API

High-level API to transform markdown into different formats.

Installation

npm install -g @accordproject/markdown-transform

Basic Usage

const transform = require('@accordproject/markdown-transform').transform;

// convert a markdown string to an html string
//   first argument is the markdown string to be converted
//   second argument is the source format
//   third argument is an array of destination formats to pass through
const htmlString = await transform(markdownString, 'markdown', ['html']);
console.log(htmlString);

Note that the call to transform returns a Promise.

The third argument to the transform function can be used to force the transform to visit an optional intermediate format. For example, passing ['ciceromark_noquotes','html'] will transform the source to ciceromark_noquotes followed by all the transformations necessary to transform from ciceromark_noquotes to html.

The example below transforms input markdown, stripping quotes from around variables, and then converts to HTML.

const result = await transform(acceptanceCiceroEdit, 'markdown', ['ciceromark_noquotes','html']);

Transformation Graph

You can generate a PlantUML state diagram for the supported transformations using the following code:

const generateTransformationDiagram = require('@accordproject/markdown-transform').generateTransformationDiagram;
const plantUMLStateDiagram = generateTransformationDiagram();

The diagram below (showing all supported transformations) is automatically generated by ./scripts/generateDiagram.js.

Transforms

License

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.

Install

npm i @accordproject/markdown-transform

DownloadsWeekly Downloads

1,885

Version

0.12.11

License

Apache-2.0

Unpacked Size

19.7 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar