Valkyrie is a compiler that takes a markdown file and converts them into an HTML file. It is built on top of Bun.js.
https://github.com/users/kdaisho/projects/5/views/1
- Install dependencies (either
bun installornpm installshould work)
pnpm install- Build
bun bd- Register the current package (valkyrie) as a "linkable" package.
bun link- Run valkyrie against an example file
valkyrie run ./examples/examples.mdAlright, so it's 2024 and it's kind of wild, but there's still no go-to spec for converting Markdown to HTML. Guess it's because Markdown has like a zillion flavors and nobody's really nailed down a one-size-fits-all standard. 🤷
So, what am I using to make sure my compiler is doing its job right? I've been bouncing between these two:
-
GitHub: These guys have a pretty solid handle on Markdown, but man, their rules for nested lists can drive you nuts.
-
Free Markdown to HTML Converter: This one's got its oddities, sure, but overall, it's been the most reliable for me.
const str = "This is ***** of the part and **at 7:00AM**, we go **there**.";
const newStr = str.replace(/(\*\*)(?=\S)(.+?)(?<=\S)\1/g, "<strong>$2</strong>");
console.log(newStr);
// This is ***** of the part and <strong>at 7:00AM</strong>, we go <strong>there</strong>.Explanation:
(\*\*)is a capturing group that matches two asterisks.(?=\S)is a positive lookahead that ensures the next character is not a whitespace, so we don't start with empty space.(.+?)captures one or more characters non-greedily.(?<=\S)is a positive lookbehind that ensures the character before the closing**is not a whitespace, so we don't end with empty space.\1refers back to the first capturing group (the opening**).- The global flag
gensures all occurrences are replaced.
