(createElement)
| 138 | }, |
| 139 | |
| 140 | render(createElement) { |
| 141 | this.md = new markdownIt() |
| 142 | .use(subscript) |
| 143 | .use(superscript) |
| 144 | .use(footnote) |
| 145 | .use(deflist) |
| 146 | .use(abbreviation) |
| 147 | .use(insert) |
| 148 | .use(mark) |
| 149 | .use(katex, { "throwOnError": false, "errorColor": " #cc0000" }) |
| 150 | .use(tasklists, { enabled: this.taskLists }) |
| 151 | |
| 152 | if (this.emoji) { |
| 153 | this.md.use(emoji) |
| 154 | } |
| 155 | |
| 156 | this.md.set({ |
| 157 | html: this.html, |
| 158 | xhtmlOut: this.xhtmlOut, |
| 159 | breaks: this.breaks, |
| 160 | linkify: this.linkify, |
| 161 | typographer: this.typographer, |
| 162 | langPrefix: this.langPrefix, |
| 163 | quotes: this.quotes, |
| 164 | }) |
| 165 | this.md.renderer.rules.table_open = () => `<table class="${this.tableClass}">\n` |
| 166 | let defaultLinkRenderer = this.md.renderer.rules.link_open || |
| 167 | function (tokens, idx, options, env, self) { |
| 168 | return self.renderToken(tokens, idx, options) |
| 169 | } |
| 170 | this.md.renderer.rules.link_open = (tokens, idx, options, env, self) => { |
| 171 | Object.keys(this.anchorAttributes).map((attribute) => { |
| 172 | let aIndex = tokens[idx].attrIndex(attribute) |
| 173 | let value = this.anchorAttributes[attribute] |
| 174 | if (aIndex < 0) { |
| 175 | tokens[idx].attrPush([attribute, value]) // add new attribute |
| 176 | } else { |
| 177 | tokens[idx].attrs[aIndex][1] = value |
| 178 | } |
| 179 | }) |
| 180 | return defaultLinkRenderer(tokens, idx, options, env, self) |
| 181 | } |
| 182 | |
| 183 | if (this.toc) { |
| 184 | this.md.use(toc, { |
| 185 | tocClassName: this.tocClass, |
| 186 | tocFirstLevel: this.tocFirstLevel, |
| 187 | tocLastLevel: this.tocLastLevelComputed, |
| 188 | anchorLink: this.tocAnchorLink, |
| 189 | anchorLinkSymbol: this.tocAnchorLinkSymbol, |
| 190 | anchorLinkSpace: this.tocAnchorLinkSpace, |
| 191 | anchorClassName: this.tocAnchorClass, |
| 192 | anchorLinkSymbolClassName: this.tocAnchorLinkClass, |
| 193 | tocCallback: (tocMarkdown, tocArray, tocHtml) => { |
| 194 | if (tocHtml) { |
| 195 | if (this.tocId && document.getElementById(this.tocId)) { |
| 196 | document.getElementById(this.tocId).innerHTML = tocHtml |
| 197 | } |
nothing calls this directly
no outgoing calls
no test coverage detected