@telefonica/markdown-confluence-sync
Version:
Creates/updates/deletes Confluence pages based on markdown files in a directory. Supports Mermaid diagrams and per-page configuration using frontmatter metadata. Works great with Docusaurus
30 lines (29 loc) • 1.06 kB
JavaScript
// SPDX-FileCopyrightText: 2024 Telefónica Innovación Digital
// SPDX-License-Identifier: Apache-2.0
import { replace } from "../../../../support/unist/unist-util-replace.js";
/**
* UnifiedPlugin to replace `<del>` HastElements with a `<span>`
* tag with the `text-decoration: line-through;` style.
*
* @see {@link https://developer.atlassian.com/server/confluence/confluence-storage-format/ | Confluence Storage Format }
*
* @example
* <del>Deleted text</del>
* // becomes
* <span style="text-decoration: line-through;">Deleted text</span>
*/
const rehypeReplaceStrikethrough = function rehypeReplaceStrikethrough() {
return function transformer(tree) {
replace(tree, { type: "element", tagName: "del" }, (node) => {
return {
type: "element",
tagName: "span",
properties: {
style: "text-decoration: line-through;",
},
children: node.children,
};
});
};
};
export default rehypeReplaceStrikethrough;