Skip to content
Closed
Changes from all commits
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
tools: build API TOC using raw headers
Markdown interprets the syntax for optional arguments as a form of a link,
so instead of trying to build up the contents using the node value, use
grab the raw original markup instead.

Fixes regression noted in #21490 (comment)
  • Loading branch information
rubys committed Jul 21, 2018
commit 484646c83c8d27c02d7ca3dfef624fc8670ec74c
6 changes: 4 additions & 2 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,10 @@ function buildToc({ filename }) {

depth = node.depth;
const realFilename = path.basename(realFilenames[0], '.md');
const headingText = node.children.map((child) => child.value)
.join().trim();
const headingText = node.children.map((child) =>
file.contents.slice(child.position.start.offset,
child.position.end.offset)
).join('').trim();
const id = getId(`${realFilename}_${headingText}`, idCounters);

const hasStability = node.stability !== undefined;
Expand Down