File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed
packages/site-kit/src/lib/markdown Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -274,16 +274,14 @@ export async function render_content_markdown(
274274
275275 return smart_quotes ( token . text , true ) ;
276276 } ,
277- heading ( { tokens, depth, raw } ) {
278- const text = this . parser ! . parseInline ( tokens ) ;
277+ heading ( { tokens, depth } ) {
278+ const text = this . parser ! . parseInline ( tokens ) . replace ( / < \/ ? c o d e > / g , '' ) ;
279279
280- headings [ depth - 1 ] = slugify ( raw ) ;
280+ headings [ depth - 1 ] = slugify ( text ) ;
281281 headings . length = depth ;
282282 const slug = headings . filter ( Boolean ) . join ( '-' ) ;
283- return `<h${ depth } id="${ slug } "><span>${ text . replace (
284- / < \/ ? c o d e > / g,
285- ''
286- ) } </span><a href="#${ slug } " class="permalink"><span class="visually-hidden">permalink</span></a></h${ depth } >`;
283+
284+ return `<h${ depth } id="${ slug } "><span>${ text } </span><a href="#${ slug } " class="permalink" aria-label="permalink"></a></h${ depth } >` ;
287285 } ,
288286 code ( { text } ) {
289287 return snippets . get ( text ) ;
Original file line number Diff line number Diff line change @@ -32,12 +32,11 @@ export function clean(markdown: string) {
3232
3333export const slugify = ( str : string ) => {
3434 return clean ( str )
35- . replace ( / & .+ ; / g, '' )
36- . replace ( / [ ^ a - z A - Z 0 - 9 - $ ( .) : ] / g, '-' )
35+ . replace ( / & .+ ? ; / g, '' )
36+ . replace ( / [ ^ a - z A - Z 0 - 9 - $ ( .) : ' ] / g, '-' )
3737 . replace ( / - { 2 , } / g, '-' )
3838 . replace ( / ^ - / , '' )
39- . replace ( / - $ / , '' )
40- . replace ( / ( < ( [ ^ > ] + ) > ) / gi, '' ) ;
39+ . replace ( / - $ / , '' ) ;
4140} ;
4241
4342export function smart_quotes ( str : string , html : boolean = false ) {
You can’t perform that action at this time.
0 commit comments