Skip to content

Commit

Permalink
juledoc: fix index hyperlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jan 17, 2025
1 parent cbcd362 commit e7966f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gen/markdown/markdown.jule
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ static markdownEscaper = strings::Replacer.New(
"_", "\\_",
"*", "\\*")

// Replaces special characters for identifiers.
// If a name will used for a hyperlink in the page, this replacer should be used.
static idEscaper = strings::Replacer.New(
"_", "-")

// Generates Markdown documentation from documentation data.
struct gen {
jmp: strings::Builder // Jump table (aka contents list).
Expand Down Expand Up @@ -166,7 +171,7 @@ impl gen {
self.jmp.WriteByte(']')!
// Write link.
self.jmp.WriteStr("(#")!
self.jmp.WriteStr(strings::ToLower(doc.Name))!
self.jmp.WriteStr(idEscaper.Replace(strings::ToLower(doc.Name)))!
n, ok := self.jmpc[doc.Name]
self.jmpc[doc.Name] = n + 1
// If this content exist already, write count.
Expand Down

0 comments on commit e7966f4

Please sign in to comment.