Last active
June 13, 2023 00:11
-
-
Save ThePlenkov/f800bc78cb33fc489d457ab8a4751413 to your computer and use it in GitHub Desktop.
Convert markdown to Confluence XHTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {MarkdownTransformer} from "@atlaskit/editor-markdown-transformer"; | |
import {defaultSchema} from "@atlaskit/adf-schema/schema-default"; | |
import {ConfluenceTransformer} from "@atlaskit/editor-confluence-transformer"; | |
import {JSDOM} from "jsdom"; | |
test("Create a new page", async () => { | |
const md = new MarkdownTransformer(defaultSchema); | |
const ct = new ConfluenceTransformer(defaultSchema); | |
const mdADF = md.parse("# Hello!"); | |
const dom = new JSDOM( | |
"<!DOCTYPE html><html><head></head><body></body></html>" | |
); | |
global.document = dom.window.document; | |
const mdXML = ct.encode(mdADF); | |
expect(mdXML).toBe("<h1>Hello!</h1>"); | |
}, 100000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment