tcmd: image element, heading links

This commit is contained in:
2024-02-28 01:43:39 -07:00
parent 6ef8c20149
commit 2e9bfa1557
4 changed files with 123 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ export const inlineTokens: {
},
},
{
rx: /\[(.*?)\]\((.*?)\)/g,
rx: /(?<!\!)\[(.*?)\]\((.*?)\)/g,
create(content, start, end, tokens) {
const [_, label, href] = content;
tokens.push({
@@ -42,4 +42,22 @@ export const inlineTokens: {
// return l
},
},
{
rx: /!\[(.*?)\]\((.*?)\)/g,
create(content, start, end, tokens) {
const [_, alt, src] = content;
tokens.push({
content: alt,
end,
start,
type: "image",
data: {
src,
},
});
},
replace(l) {
return l;
},
},
];