-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Jira markup to markdown #291
Comments
Did some quick research 🔎 and some more digging in my 🧠… Atlassian markup format There's some more information on the Jira markup syntax here: Not a formal specification, but I hope this gives a good overview of the syntax. Get fields as HTML from API There could be another pointer here: The Jira API can apparently return markup fields rendered to HTML via "expansion". Maybe the HTML can be converted to a plain-text or markdown description more reliably. Drill open one of the Atlassian client packages? There is a page listing a lot of Atlassian's software packages from their so-called "atlaskit": Maybe there's something that can help us? Get ADF format & render that? I checked the network tab and it looks like (the hosted Jira at least) now has and uses a GraphQL API which returns values as ADF (Atlassiant Document Format). Maybe it'd be possible to convert this structured representation into a commit-compatible text-format more easily? |
Briefly looked into this topic yesterday as well. I think the HTML -> Markdown is a very promising approach 👍 |
Looks like Gave it a quick try. Grab the HTML description from the rendered fields: Install showdown: yarn add showdown Then, in // Showdown requires a browser-like environment, so we use JSDOM here
const { JSDOM } = require("jsdom");
const { window } = new JSDOM("");
const { document } = window;
const { Converter } = require("showdown");
const converter = new Converter();
const html = `…`;
console.log(converter.makeMarkdown(html)); Already spotted some problems though:
Showdown supports custom extensions, but it sounds like another 🐇🕳️ |
What if we just convert to plain-text though @maltoe and @klappradla? const { JSDOM } = require("jsdom");
const { window } = new JSDOM(html);
console.log(window.document.body.textContent) This seems to work well. It does mean however that you lose links, code block delimiters… all that. Lists are likely to be a problem too, so I'm not sure whether it's an improvement over the current behavior, just passing through the markup. In Tickety-Tick itself we wouldn't need JSDOM (we're already in a browser context). |
I'd personally actually be in favor of that 👍. It make less assumptions about the workflows of people. |
Okay, I think I've found the way forward:
|
Convert Jira's ADF (Atlassian Document Format) used in ticket descriptions to Markdown to use it as a commit message body. - use v3 of the Jira API - transform ADF to mdast (Markdown abstract syntax tree) - convert mdast to actual Markdown Closes #291
Convert Jira's ADF (Atlassian Document Format) used in ticket descriptions to Markdown to use it as a commit message body. - use v3 of the Jira API - transform ADF to mdast (Markdown abstract syntax tree) - convert mdast to actual Markdown Closes #291
👋 I would really like to be able to take the description from Jira tickets and copy it to commit messages.
The text was updated successfully, but these errors were encountered: