Skip to content

feature: support customized sidebar item name from content #1825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor for better readability
  • Loading branch information
Jacco-V committed Jun 23, 2022
commit f536e724fd88d7bf2d05d7daf31ed8048ad6cdc6
2 changes: 1 addition & 1 deletion src/core/render/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ export class Compiler {

const slug = slugify(config.id || str);
const url = router.toURL(router.getCurrentPath(), { id: slug });
nextToc.label = removeAtag(config.sidebar || str);
nextToc.title = removeAtag(str);
nextToc.label = config.sidebar || nextToc.title;
nextToc.slug = url;
_self.toc.push(nextToc);

Expand Down
2 changes: 1 addition & 1 deletion src/core/render/compiler/headline.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const headingCompiler = ({ renderer, router, _self }) =>

const slug = slugify(config.id || str);
const url = router.toURL(router.getCurrentPath(), { id: slug });
nextToc.label = removeAtag(config.sidebar || str);
nextToc.title = removeAtag(str);
nextToc.label = config.sidebar || nextToc.title;
nextToc.slug = url;
_self.toc.push(nextToc);

Expand Down