fix bug where links didn't happen in markdown tables

This commit is contained in:
Adam Teichert
2025-12-16 21:20:16 -07:00
parent e9f33e0174
commit 859bdf01f2
2 changed files with 21 additions and 2 deletions

View File

@@ -52,15 +52,18 @@ marked.use({ extensions: [mermaidExtension] });
// The renderer only applies to markdown tables.
marked.use({
renderer: {
tablecell({ text, header, align }) {
tablecell(token) {
const content = this.parser.parseInline(token.tokens);
const { header, align } = token;
const type = header ? "th" : "td";
const alignAttr = align ? ` align="${align}"` : "";
const scopeAttr = header ? ' scope="col"' : "";
return `<${type}${scopeAttr}${alignAttr}>${text}</${type}>\n`;
return `<${type}${scopeAttr}${alignAttr}>${content}</${type}>\n`;
},
},
});
export function extractImageSources(htmlString: string) {
const srcUrls = [];
const regex = /<img[^>]+src=["']?([^"'>]+)["']?/g;