Astro CLI documentation starter
const SECTION_SPLITTER = "---SECTION_SPLITTER---";
// convert split sections to explicit string from regex
let scrubbedContent = textContent.replace(
new RegExp("^[=,-]+$", "gm"),
SECTION_SPLITTER
);
const rawSections = scrubbedContent
.split(SECTION_SPLITTER)
.map((section) => scrubContent(section.trim()));
const TITLE_SPLITTER = "---TITLE_SPLITTER---";
const sections: HelpSection[] = rawSections.map((section, index) => {
const lines: string[] = section.split("\n");
const [firstLine, ...otherLines] = lines;
const scrubbedFirstLine = firstLine.replace(
new RegExp("\\s{2,}", "gm"),
TITLE_SPLITTER
);
const [title, rawAnchor] = scrubbedFirstLine.split(TITLE_SPLITTER);
Before:
elseif node_name == 'argument' then
return ('%s<code>{%s}</code>'):format(ws(), text)
After:
elseif node_name == 'argument' then
return ('%s`{%s}`'):format(ws(), text)
Frontmatter
Still using Regex
https://cmgriffing.github.io/neovim-docs-web/en/
Docsearch is free for open source projects