mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-23 13:31:06 +08:00
fix: lint
This commit is contained in:
parent
6aa378f59c
commit
5ff9cfc08a
@ -1,5 +1,5 @@
|
||||
// const mdLoader = require('./NaiveUIMdLoader')
|
||||
const marked = require('marked')
|
||||
// const marked = require('marked')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '../../../CHANGELOG.zh-CN.md')).toString()
|
||||
@ -7,14 +7,14 @@ const content = fs.readFileSync(path.resolve(__dirname, '../../../CHANGELOG.zh-C
|
||||
|
||||
const mdLoader = require('../NaiveUIMdLoader')
|
||||
|
||||
function parseMdAsAnchor (content) {
|
||||
const tokens = marked.lexer(content)
|
||||
const titles = tokens.filter(token => token.type === 'heading' && token.depth === 2).map(token => token.text)
|
||||
const linkTags = titles.map(title => {
|
||||
const href = title.replace(/ /g, '-')
|
||||
return `<n-anchor-link title="${title}" href="#${href}"/>`
|
||||
})
|
||||
return `<n-anchor :top="32" position="absolute" affix style="width: 132px;">${linkTags.join('\n')}</n-anchor>`
|
||||
}
|
||||
// function parseMdAsAnchor (content) {
|
||||
// const tokens = marked.lexer(content)
|
||||
// const titles = tokens.filter(token => token.type === 'heading' && token.depth === 2).map(token => token.text)
|
||||
// const linkTags = titles.map(title => {
|
||||
// const href = title.replace(/ /g, '-')
|
||||
// return `<n-anchor-link title="${title}" href="#${href}"/>`
|
||||
// })
|
||||
// return `<n-anchor :top="32" position="absolute" affix style="width: 132px;">${linkTags.join('\n')}</n-anchor>`
|
||||
// }
|
||||
|
||||
console.log(mdLoader.call({ resourcePath: 'xxx' }, content, 'xxx'))
|
||||
|
Loading…
Reference in New Issue
Block a user