forked from vuejs-translations/docs-fa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
textAdMdPlugin.ts
34 lines (31 loc) · 1013 Bytes
/
textAdMdPlugin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import MarkdownIt from 'markdown-it'
const excludedPages = [
'guide/introduction.md',
// 'guide/quick-start.md',
// 'guide/essentials/computed.md',
// 'guide/essentials/conditional.md',
// 'guide/essentials/list.md',
// 'guide/essentials/event-handling.md',
// 'guide/essentials/forms.md',
// 'guide/components/registration.md',
// 'guide/components/props.md',
// 'guide/components/events.md',
// 'guide/components/slots.md',
// 'guide/built-ins/teleport.md',
'about/faq.md',
'about/team.md',
'about/releases.md',
'about/community-guide.md',
'about/coc.md',
'sponsor/index.md',
'translations/index.md'
]
export const textAdPlugin = (md: MarkdownIt) => {
md.renderer.rules.heading_close = (tokens, i, options, env, self) => {
const relativePath = env.relativePath
const renderedContent = self.renderToken(tokens, i, options)
return excludedPages.includes(relativePath)
? renderedContent
: renderedContent.replace(/<\/h1>/, '</h1><TextAd/>')
}
}