tcmd: styled links
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user