| 123456789101112131415161718192021222324252627 |
- export default class TocAndAnchorConfigurer {
- constructor(crowi, renderToc) {
- this.crowi = crowi;
- this.renderToc = renderToc;
- }
- configure(md) {
- md.use(require('markdown-it-toc-and-anchor-with-slugid').default, {
- tocLastLevel: 3,
- anchorLinkBefore: false,
- anchorLinkSymbol: '',
- anchorLinkSymbolClassName: 'icon-link',
- anchorClassName: 'revision-head-link',
- });
- // set toc render function
- if (this.renderToc != null) {
- md.set({
- tocCallback: (tocMarkdown, tocArray, tocHtml) => {
- this.renderToc(tocHtml);
- },
- });
- }
- }
- }
|