Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 94x 92x 92x 54x 53x 53x | /**
* Markdown to HTML converter for CV content
* Uses remark ecosystem for consistent parsing with the rest of the project
*/
import remarkGfm from 'remark-gfm';
import remarkHtml from 'remark-html';
import remarkParse from 'remark-parse';
import { unified } from 'unified';
/**
* Convert markdown text to HTML
* Supports: bold, italic, links, code, blockquotes, lists, images, horizontal rules
*/
export function markdownToHtml(text: string): string {
if (!text) return '';
const result = unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkHtml, { sanitize: false })
.processSync(text);
return String(result).trim();
}
/**
* Convert inline markdown to HTML (strips block-level wrapper tags like <p>)
* Use this for single-line content where you don't want paragraph wrapping
*/
export function inlineMarkdownToHtml(text: string): string {
if (!text) return '';
const html = markdownToHtml(text);
// Remove wrapping <p> tags for inline content
return html.replace(/^<p>(.*)<\/p>$/s, '$1');
}
|