Created
July 1, 2018 21:53
-
-
Save hagenburger/71925f9b15a0318a20f2371708cf28d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Config = require('../lib/config') | |
const Document = require('../lib/document') | |
const config = new Config() | |
config.commands[':'] = function (pi) { | |
pi.renderer.config.parseInfoString(pi.content.trim(), pi) | |
} | |
config.addInfoStringParser(/#([^ ]+)/, function (match, id) { | |
this.element.id = id | |
}) | |
const source = ` | |
# Headline <?: #headline-id ?> | |
Lorem ipsum dolor sit amet <?: #paragraph-id ?>, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
~~~ html #code-id | |
<p></p> | |
~~~ | |
| Table <?: #th-id ?> | Table | | |
|---------------------|---------------------| | |
| Table | Table <?: #td-id ?> | | |
` | |
const doc = new Document(source, config) | |
doc.renderDocument().then(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment