tent-markdown-js
Tent Dialect for markdown-js.
Installation
npm install tent-markdown
Usage
### Node
var markdown = require( "tent-markdown" ).markdown;
console.log( markdown.toHTML( "Hello *World*!", "Tent", { footnotes: [] } ) );
### Browser
<!DOCTYPE html>
<html>
<body>
<textarea id="text-input" oninput="this.editor.update()"
rows="6" cols="60">^[You](0), Type _Tent_ **Markdown** here.</textarea>
<div id="preview"> </div>
<script src="lib/tent-markdown.js"></script>
<script>
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value, 'Tent', { footnotes: ["https://entity.example.org"] });
};
input.editor = this;
this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
</body>
</html>
The above example is adapted from markdown-js.
Simply put,
var source = "^[Example Mention](0), *Bold*, _Italic_, ~Strikethrough~, [Regular link](https://tent.io)...",
entity_uris = ["https://entity.example.org"];
window.markdown.toHTML( source, 'Tent', { footnotes: entity_uris } )
where entity_uris
is an Array
of entity uris with indices mapping to integer links in the markdown source.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request