Files
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

25 lines
638 B
TypeScript

import type MarkdownIt from "markdown-it";
export default function markdownUnderlines(md: MarkdownIt) {
md.inline.ruler2.after("emphasis", "underline", (state) => {
const tokens = state.tokens;
for (let i = tokens.length - 1; i > 0; i--) {
const token = tokens[i];
if (token.markup === "__") {
if (token.type === "strong_open") {
tokens[i].tag = "underline";
tokens[i].type = "underline_open";
}
if (token.type === "strong_close") {
tokens[i].tag = "underline";
tokens[i].type = "underline_close";
}
}
}
return false;
});
}