diff --git a/site/src/routes/docs/_sections.js b/site/src/routes/docs/_sections.js index 6a10659a84..ec23a65087 100644 --- a/site/src/routes/docs/_sections.js +++ b/site/src/routes/docs/_sections.js @@ -48,6 +48,8 @@ export default function() { const { content, metadata } = extract_frontmatter(markdown); + const sectionSlug = makeSlug(metadata.title); + const subsections = []; const renderer = new marked.Renderer(); @@ -142,7 +144,7 @@ export default function() { html: html.replace(/@@(\d+)/g, (m, id) => hashes[id] || m), metadata, subsections, - slug: file.replace(/^\d+-/, '').replace(/\.md$/, ''), + slug: sectionSlug, file, }; }); diff --git a/site/src/utils/markdown.js b/site/src/utils/markdown.js index e1021664c3..39fba4023f 100644 --- a/site/src/utils/markdown.js +++ b/site/src/utils/markdown.js @@ -45,10 +45,10 @@ export const langs = { // links renderer -export function link_renderer(href,title,text) { +export function link_renderer (href, title, text) { let target_attr = ''; let title_attr = ''; - + if(href.startsWith("http")) { target_attr = ' target="_blank"'; } @@ -56,6 +56,6 @@ export function link_renderer(href,title,text) { if(title !== null) { title_attr = ` title="${title}"`; } - + return `${text}`; -}; \ No newline at end of file +}; diff --git a/site/src/utils/slug.js b/site/src/utils/slug.js index 882d268b08..4ad7b96b2a 100644 --- a/site/src/utils/slug.js +++ b/site/src/utils/slug.js @@ -17,13 +17,6 @@ const unicodeRegex = /\p{Letter}/u; const isNonAlphaNumUnicode = string => !alphaNumRegex.test(string) && unicodeRegex.test(string); -const nonUnicodeSanitizer = string => - string - .toLowerCase() - .replace(/[^a-zA-Z0-9]+/g, '-') - .replace(/^-/, '') - .replace(/-$/, ''); - export const unicodeSafeProcessor = string => string.split('') .reduce((accum, char, index, array) => { @@ -48,7 +41,6 @@ export const unicodeSafeProcessor = string => .reduce((accum, chunk) => { const processed = chunk.type === 'process' ? limaxProcessor(chunk.string) - // ? nonUnicodeSanitizer(chunk.string) : chunk.string; processed.length > 0 && accum.push(processed);