@@ -76,12 +76,14 @@ const removeCustomIds = (token: Token) => {
76
76
interface Options {
77
77
extractTitle ?: boolean ;
78
78
supportGithubAnchors ?: boolean ;
79
+ disableSEOFixForTitles ?: boolean ;
79
80
transformLink : ( v : string ) => string ;
80
81
getPublicPath ?: ( options : Options , v ?: string ) => string ;
81
82
}
82
83
83
84
const index : MarkdownItPluginCb < Options > = ( md , options ) => {
84
- const { extractTitle, path, log, supportGithubAnchors, getPublicPath} = options ;
85
+ const { extractTitle, path, log, supportGithubAnchors, getPublicPath, disableSEOFixForTitles} =
86
+ options ;
85
87
86
88
const plugin = ( state : StateCore ) => {
87
89
/* Do not use the plugin if it is included in the file */
@@ -143,9 +145,16 @@ const index: MarkdownItPluginCb<Options> = (md, options) => {
143
145
const anchorTitle = removeCustomId ( title ) . replace ( / ` / g, '' ) ;
144
146
allAnchorIds . forEach ( ( customId ) => {
145
147
const setId = id !== customId ;
146
- const linkTokens = createLinkTokens ( state , customId , anchorTitle , setId , href ) ;
147
-
148
- inlineToken . children ?. unshift ( ...linkTokens ) ;
148
+ if ( ! disableSEOFixForTitles ) {
149
+ const linkTokens = createLinkTokens (
150
+ state ,
151
+ customId ,
152
+ anchorTitle ,
153
+ setId ,
154
+ href ,
155
+ ) ;
156
+ inlineToken . children ?. unshift ( ...linkTokens ) ;
157
+ }
149
158
150
159
if ( supportGithubAnchors ) {
151
160
const ghLinkTokens = createLinkTokens ( state , ghId , anchorTitle , true , href ) ;
0 commit comments