From 724b026f69ee7aadad5b9599bbf37515b99999a0 Mon Sep 17 00:00:00 2001 From: mgt Date: Sat, 13 Nov 2021 15:24:41 +0800 Subject: [PATCH] fix: fix footnote heading plugin --- .../plugins/rehype-footnote-heading/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gatsby-theme-oi-wiki/plugins/rehype-footnote-heading/index.js b/gatsby-theme-oi-wiki/plugins/rehype-footnote-heading/index.js index ca0058cf0..d458187f7 100644 --- a/gatsby-theme-oi-wiki/plugins/rehype-footnote-heading/index.js +++ b/gatsby-theme-oi-wiki/plugins/rehype-footnote-heading/index.js @@ -5,12 +5,13 @@ module.exports = function () { visit(ast, 'element', function (node, index, parent) { if (node.tagName !== 'h2') return if (node.properties['id'] !== 'footnote-label') return - - parent[index] = { - type: 'element', - tagName: 'hr', - properties: node.properties + const properties = node.properties + for (const i of Object.keys(node)) { + delete node[i] } - }) + node.type = 'element' + node.tagName = 'hr' + node.properties = properties + node.properties['className'].push('MuiDivider-root', 'makeStyles-divider-4') } -} \ No newline at end of file +}