-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add jira tickets auto conversion #555
Conversation
8440276
to
e41169d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I left a few comments for your consideration.
love/src/Utils.js
Outdated
@@ -1853,6 +1853,8 @@ export function trimString(string, length = 100) { | |||
/** | |||
* Function to parse HTML, generated by react-quill, to Jira Markdown. | |||
* Check https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all for more info | |||
* This function also parse Jira tickets names that are not hyperlinks. | |||
* Allowed projects are in AUTO_HYPERLINK_JIRA_PROJECTS. | |||
* @param {string} html html to be parsed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to your PR, but it the double html
here correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @wvreeven, thanks and good catch! So the first html
is the name of the variable itself, although I will adjust the description for better readability. Here are some examples from the oficial docs: https://jsdoc.app/tags-param.html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation. Perhaps place a hyphen -
between both, as suggested by the docs link, so it is clear which is the variable name and where the description starts?
const expectedOutput = | ||
'This is a string with mixed content\r\nh1. This is a heading.\r\nThis is an already formatted link [DM-41184|https://jira.lsstcorp.org/browse/DM-41184].\r\nThis is a ticket name not yet formatted [DM-41184|https://jira.lsstcorp.org/browse/DM-41184].\r\n'; | ||
expect(htmlToJiraMarkdown(input)).toEqual(expectedOutput); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a third test case, where
[DM-41184|https://jira.lsstcorp.org/browse/DM-41184]
is already present to make sure that it remains formatted correctly.
dec8712
to
91ad75b
Compare
…s to links Also made `jiraMarkdownToHtml` hyperlinks parsing more robuts
Also update package.json
91ad75b
to
58d2426
Compare
This PR extends the
htmlToJiraMarkdown
function to support auto conversion of jira tickets to hyperlinks, e.g. DM-41184 -> DM-41184.