tcmd: styled links

This commit is contained in:
2024-02-29 02:37:50 -07:00
parent 18f8541de7
commit 7f63d38424
4 changed files with 26 additions and 7 deletions

View File

@@ -94,12 +94,27 @@ export const inlineTokens: {
{
rx: /(?<![\!\?|^])\[(.*?)\]\((.*?)\)/g,
create(content, start, end, tokens) {
const [_, label, href] = content;
let [_, label, href] = content;
const style = [
{
classes: "btn-primary inline-block",
rx: /^```button\s/,
},
{
classes: "btn-secondary inline-block uppercase",
rx: /^```cta\s/,
},
].find((s) => s.rx.test(label));
if (style) label = label.replace(style.rx, "");
tokens.push({
content: label,
type: "anchor",
data: {
href,
style,
},
start,
end,