dessert-markdown-core
v0.2.1
Published
WASM core for showdown module
Downloads
15
Readme
Dessert Markdown
Exposes the base API for the showdown and marked modules, written in Rust for WebAssembly.
Table of contents
Usage
This module is not supposed to be used directly as a dependence by an application, it is used as a backend for js connector
var showdown = require('dessert-markdown-core'),
converter = new showdown.Converter(),
text = '# hello, markdown!',
html = converter.makeHtml(text);
API
make_html(markdown_string, options)
Converts Markdown to HTML
get_option(key)
Returns the value of the given option key
set_option(key, value)
Sets the value of the given option key
get_options()
Returns all the options and their values
Valid Options
noHeaderId: (boolean) [default false] Disable the automatic generation of header ids. Setting to true overrides prefixHeaderId
customizedHeaderId: (boolean) [default false] Use text in curly braces as header id.
ghCompatibleHeaderId: (boolean) [default false] Generate header ids compatible with github style (spaces are replaced with dashes and a bunch of non alphanumeric chars are removed)
prefixHeaderId: (string/boolean) [default false] Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to
true
will add a generic 'section' prefix.rawPrefixHeaderId: (boolean) [default false] Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix). Has no effect if prefixHeaderId is set to false.
rawHeaderId: (boolean) [default false] Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids.
headerLevelStart: (integer) [default 1] Set the header starting level.
strikethrough: (boolean) [default false] Enable support for strikethrough syntax.
tables: (boolean) [default false] Enable support for tables syntax.
tasklists: (boolean) [default false] Enable support for GFM tasklists.
simpleLineBreaks: (boolean) [default false] Parses line breaks as
<br>
, without needing 2 spaces at the end of the line.requireSpaceBeforeHeadingText: (boolean) [default false] Makes adding a space between
#
and the header text mandatory.ghMentions: (boolean) [default false] Enables github @mentions, which link to the username mentioned.
ghMentionsLink: (string) [default
https://github.com/{u}
] Changes the link generated by @mentions.openLinksInNewWindow: (boolean) [default false] Open all links in new windows
emoji: (boolean) [default false] Enable emoji support. Ex:
this is a :smile: emoji
Installation
dessert-markdown-core is depended on by dessert-showdown
npm install dessert-markdown-core
Building
The project is built using wasm-pack
To build the project, run
wasm-pack build
Testing
wasm-pack test --headless --firefox # or --chrome
License
MIT
Contributing
See CONTRIBUTING.md