From 935e2c1052eecfa3c4cc827711c57de92b1f1c5d Mon Sep 17 00:00:00 2001 From: TheNorthMemory <1631685+TheNorthMemory@users.noreply.github.com> Date: Sun, 28 Jul 2024 19:34:34 +0800 Subject: [PATCH] fix(markdown/table): use `Token.attr[Get|Join]` insteed the hardcode `tabindex` attr --- src/node/markdown/markdown.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index a423ee19cc03..9d2bd433a491 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -231,8 +231,12 @@ export const createMarkdownRenderer = async ( ) .use(lineNumberPlugin, options.lineNumbers) + const orgi = md.renderer.rules.table_open md.renderer.rules.table_open = function (tokens, idx, options, env, self) { - return '\n' + tokens[idx].attrGet('tabindex') ?? tokens[idx].attrJoin('tabindex', '0') + return orgi + ? orgi(tokens, idx, options, env, self) + : self.renderToken(tokens, idx, options) } if (options.gfmAlerts !== false) {