1 | /* Dependencies. */
|
2 | const xtend = require('xtend')
|
3 | const one = require('./one')
|
4 | const preprocess = require('./pre-visitors')
|
5 |
|
6 | /* Expose. */
|
7 | module.exports = stringify
|
8 |
|
9 | /* Stringify the given MDAST node. */
|
10 | function toLaTeX (node, options, root) {
|
11 | return one(options, node, undefined, undefined, root)
|
12 | }
|
13 |
|
14 | /* Compile MDAST tree using toLaTeX */
|
15 | function stringify (config) {
|
16 | const settings = xtend(config, this.data('settings'))
|
17 |
|
18 | this.Compiler = compiler
|
19 |
|
20 | function compiler (tree) {
|
21 | preprocess(settings, tree)
|
22 | return toLaTeX(tree, settings, tree)
|
23 | }
|
24 | }
|