A slightly outdated version of the code is available in the public atlaskit repo:
You can give it a try since for now it is not granted that an official endpoint will be released.
Example:
import { defaultSchema } from '@atlaskit/adf-schema'; import { JSONTransformer } from '@atlaskit/editor-json-transformer'; import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer'; const jsonTransformer = new JSONTransformer(); const markdownTransformer = new MarkdownTransformer(defaultSchema); const markdownDocument = ''; const adfDocument = jsonTransformer.encode(markdownTransformer.parse(markdownDocument));
Summary
As written in the below thread in the Atlassian Community, up until some time ago there used to be the api https://api.atlassian.com/pf-editor-service/convert?from=xxxx&to=xxx for converting Markdown, Markup, HTMl, etc to Atlassian Document Format and vice-versa:
By using this endpoint you could easily convert formats as described in below table:
This endpoint was not documented and therefore not supported stopped and it was decommissioned around the beginning of September. It would be nice to get an official endpoint customers can use to easily convert among formats.
Workaround
If you need to convert from ADF to HTML you can use the following workaround:
- To get the comment body returned as HTML call the GET /rest/api/3/[ISSUE KEY or ID]/comments endpoint and append ?expand=renderedBody to it:
https://NAME.atlassian.net/rest/api/3/issue/{ISSUE-KEY_OR_ID}/comment?expand=renderedBody
- To get the issue description returned as HTML use the /rest/api/3/issue/{issueIdOrKey} endpoint followed by ?expand=renderedFields:
https://NAME.atlassian.net/rest/api/3/issue/{ISSUE-KEY_OR_ID}?expand=renderedFields
- is duplicated by
-
JSWCLOUD-24204 Option to convert the HTML Value properly in Jira fields when imported via API to ADF
- Closed
- is related to
-
JRACLOUD-67210 Convert html tags to markup during import process
- Gathering Interest
-
JRACLOUD-72631 Provide users with a plain text markdown editor
- Future Consideration
-
ACE-3602 Loading...
- relates to
-
JRACLOUD-72220 Java client for building/parsing ADF
- Closed
- is action for
-
VOC-1875 Loading...