Skip to content

Commit

Permalink
fix(heading): Double text in mini-toc
Browse files Browse the repository at this point in the history
  • Loading branch information
makishvili authored and 3y3 committed Jul 7, 2023
1 parent 39764be commit 2d0a700
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transform/headings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Heading} from './typings';
function getTitle(token: Token) {
return (
token.children?.reduce((acc, tok) => {
if (tok.type === 'text' || tok.type === 'code_inline') {
if ((tok.type === 'text' && !tok.meta?.hidden) || tok.type === 'code_inline') {
return acc + tok.content;
}

Expand Down
1 change: 1 addition & 0 deletions src/transform/plugins/anchors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function createLinkTokens(state: StateCore, id: string, title: string, setId = f
const spanClose = new state.Token('span_close', 'span', -1);
spanOpen.attrSet('class', 'visually-hidden');
spanText.content = title;
spanText.meta = {hidden: true};

return [open, spanOpen, spanText, spanClose, close];
}
Expand Down

0 comments on commit 2d0a700

Please sign in to comment.