chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -29,10 +29,7 @@ md.enable("strikethrough");
|
||||
* can intentionally include them, while escaping other uses of "<" and ">".
|
||||
*/
|
||||
function escapeSlackMrkdwnSegment(text: string): string {
|
||||
return text
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">");
|
||||
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
|
||||
const SLACK_ANGLE_TOKEN_RE = /<[^>\n]+>/g;
|
||||
@@ -69,9 +66,7 @@ function escapeSlackMrkdwnText(text: string): string {
|
||||
const matchIndex = match.index ?? 0;
|
||||
out.push(escapeSlackMrkdwnSegment(text.slice(lastIndex, matchIndex)));
|
||||
const token = match[0] ?? "";
|
||||
out.push(
|
||||
isAllowedSlackAngleToken(token) ? token : escapeSlackMrkdwnSegment(token),
|
||||
);
|
||||
out.push(isAllowedSlackAngleToken(token) ? token : escapeSlackMrkdwnSegment(token));
|
||||
lastIndex = matchIndex + token.length;
|
||||
}
|
||||
|
||||
@@ -89,8 +84,7 @@ function getLinkStack(env: RenderEnv): { href: string }[] {
|
||||
return env.slackLinkStack;
|
||||
}
|
||||
|
||||
md.renderer.rules.text = (tokens, idx) =>
|
||||
escapeSlackMrkdwnText(tokens[idx]?.content ?? "");
|
||||
md.renderer.rules.text = (tokens, idx) => escapeSlackMrkdwnText(tokens[idx]?.content ?? "");
|
||||
|
||||
md.renderer.rules.softbreak = () => "\n";
|
||||
md.renderer.rules.hardbreak = () => "\n";
|
||||
|
||||
Reference in New Issue
Block a user