Adjusts in the regex used to replace spaces with dashes in the header of wiki links and adjusted the unit tests

This commit is contained in:
leonardo.farias
2023-11-01 21:50:52 -03:00
parent 85bb6cb98c
commit 1663b09a86
4 changed files with 7 additions and 8 deletions

View File

@@ -116,7 +116,7 @@ function fromMarkdown(opts: FromMarkdownOptions = {}) {
// remove leading # if the target is a heading on the same page
const displayName = alias || target.replace(/^#/, "");
const headingId = heading.replace(/\s+/, "-").toLowerCase();
const headingId = heading.replace(/\s+/g, "-").toLowerCase();
let classNames = wikiLinkClassName;
if (!matchingPermalink) {
classNames += " " + newClassName;

View File

@@ -99,7 +99,7 @@ function html(opts: HtmlOptions = {}) {
// remove leading # if the target is a heading on the same page
const displayName = alias || target.replace(/^#/, "");
// replace spaces with dashes and lowercase headings
const headingId = heading.replace(/\s+/, "-").toLowerCase();
const headingId = heading.replace(/\s+/g, "-").toLowerCase();
let classNames = wikiLinkClassName;
if (!matchingPermalink) {
classNames += " " + newClassName;