WIP: c9f5dfc Update 'content/projects/RE-Chess.md'
This commit is contained in:
@@ -74,6 +74,24 @@ export const getAllProjectsFrontMatter = (): Post[] => {
|
||||
);
|
||||
};
|
||||
|
||||
export const getHeadings = (markdown: string): any => {
|
||||
const headingOne = markdown.match(/^(#{1})\s(.*)/gm);
|
||||
const headingTwo = markdown.match(/^(#{2})\s(.*)/gm);
|
||||
const headingThree = markdown.match(/^(#{3})\s(.*)/gm);
|
||||
const headingFour = markdown.match(/^(#{4})\s(.*)/gm);
|
||||
|
||||
const headings = markdown.match(/^(#{1,4})\s(.*)/gm);
|
||||
var tree: any[] = [];
|
||||
var prev = "";
|
||||
headings?.forEach((heading) => {
|
||||
if (headingOne?.includes(heading)) {
|
||||
tree.push(heading);
|
||||
}
|
||||
});
|
||||
|
||||
return tree;
|
||||
};
|
||||
|
||||
export async function markdownToHtml(markdown: any) {
|
||||
const result = await remark().use(html).process(markdown);
|
||||
return result.toString();
|
||||
|
||||
Reference in New Issue
Block a user