Skip to content

Commit

Permalink
update tinydocs-template.txt and tinydocs-with-search.html
Browse files Browse the repository at this point in the history
  • Loading branch information
JMcrafter26 committed Nov 8, 2024
1 parent b706f83 commit efdc151
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion builder/tinydocs-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,10 @@ function snarkdown(md) {
const tempDiv = document.createElement("div");
tempDiv.innerHTML = htmlContent;
tempDiv.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((heading) => {
const id = heading.textContent.toLowerCase().replace(/[^a-z0-9]+/g, '-');
let id = heading.textContent.toLowerCase().replace(/[^a-z0-9]+/g, '-');
// if there are non a-z0-9 characters, remove them
id = id.replace(/[^a-z0-9-]/g, '');

heading.setAttribute("id", id);
});
pg.innerHTML = tempDiv.innerHTML;
Expand Down
5 changes: 4 additions & 1 deletion test/tinydocs-with-search.html
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,10 @@ <h4 id="messageTitle"></h4>
const tempDiv = document.createElement("div");
tempDiv.innerHTML = htmlContent;
tempDiv.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((heading) => {
const id = heading.textContent.toLowerCase().replace(/[^a-z0-9]+/g, '-');
let id = heading.textContent.toLowerCase().replace(/[^a-z0-9]+/g, '-');
// if there are non a-z0-9 characters, remove them
id = id.replace(/[^a-z0-9-]/g, '');

heading.setAttribute("id", id);
});
pg.innerHTML = tempDiv.innerHTML;
Expand Down

0 comments on commit efdc151

Please sign in to comment.