File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,12 @@ Only when you set both the `routerMode: 'history'` and `externalLinkTarget: '_se
127127### Hello, world! :id=hello-world
128128```
129129
130+ ## Customise item name for sidebar
131+
132+ ``` md
133+ ### How would I write a "hello, world" example? :sidebar="Hello, world?"
134+ ```
135+
130136## Markdown in html tag
131137
132138You need to insert a space between the html and markdown content.
Original file line number Diff line number Diff line change @@ -233,12 +233,14 @@ export class Compiler {
233233 nextToc . ignoreAllSubs = true ;
234234 }
235235
236+ const title = config . sidebar || str ;
236237 const slug = slugify ( config . id || str ) ;
237238 const url = router . toURL ( router . getCurrentPath ( ) , { id : slug } ) ;
239+ nextToc . title = removeAtag ( title ) ;
238240 nextToc . slug = url ;
239241 _self . toc . push ( nextToc ) ;
240242
241- return `<h${ level } id="${ slug } "><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ str } </span></a></h${ level } >` ;
243+ return `<h${ level } id="${ slug } "><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ title } </span></a></h${ level } >` ;
242244 } ;
243245
244246 origin . code = highlightCodeCompiler ( { renderer } ) ;
You can’t perform that action at this time.
0 commit comments