mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
fix(share): heading and navigation not supporting CJK (closes #6430)
This commit is contained in:
@@ -90,7 +90,6 @@ const currentTheme = note.getLabel("shareTheme") === "light" ? "light" : "dark";
|
||||
const themeClass = currentTheme === "light" ? " theme-light" : " theme-dark";
|
||||
const headingRe = /(<h[1-6]>)(.+?)(<\/h[1-6]>)/g;
|
||||
const headingMatches = [...content.matchAll(headingRe)];
|
||||
const slugify = (text) => text.toLowerCase().replace(/[^\w]/g, "-");
|
||||
content = content.replaceAll(headingRe, (...match) => {
|
||||
match[0] = match[0].replace(match[3], `<a id="${slugify(match[2])}" class="toc-anchor" name="${slugify(match[2])}" href="#${slugify(match[2])}">#</a>${match[3]}`);
|
||||
return match[0];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<%
|
||||
const slugify = (text) => text.toLowerCase().replace(/[^\w]/g, "-");
|
||||
const slug = slugify(entry.name);
|
||||
%>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user