Skip to content
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

[jira] Convert description to markdown #415

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

ricoberger
Copy link
Member

The description of an issue is now converted to markdown before we
render the description. This is necessary because Jira returns the
description in a wiki markup format, which doesn't look good when it is
directly passed to the ReactMarkdown component for rendering.

We also changed the logic to display the details of an issue, so that
only the fields which are relly available are displayed in the details.
This means if for example an issue doesn't have subtasks we do not
display the subtasks section anymore.

We also changed the color of the status label, so that the label matches
the color in Jira. The previously used color field seems to be
deprecated and Jira only allows 3 status categories. For these
categories we set the color: "Done" -> "green", "In Progress" -> "blue"
and "Open" -> "grey".

The description of an issue is now converted to markdown before we
render the description. This is necessary because Jira returns the
description in a wiki markup format, which doesn't look good when it is
directly passed to the ReactMarkdown component for rendering.

We also changed the logic to display the details of an issue, so that
only the fields which are relly available are displayed in the details.
This means if for example an issue doesn't have subtasks we do not
display the subtasks section anymore.

We also changed the color of the status label, so that the label matches
the color in Jira. The previously used color field seems to be
deprecated and Jira only allows 3 status categories. For these
categories we set the color: "Done" -> "green", "In Progress" -> "blue"
and "Open" -> "grey".
.replace(/~([^~]*)~/g, '<sub>$1</sub>')
.replace(/(\s+)-(\S+.*?\S)-(\s+)/g, '$1~~$2~~$3')
.replace(
/\{code(:([a-z]+))?([:|]?(title|borderStyle|borderColor|borderWidth|bgColor|titleBGColor)=.+?)*\}([^]*?)\n?\{code\}/gm,

Check failure

Code scanning / CodeQL

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings starting with '{{codetitle=' and containing many repetitions of 'atitle='.
.replace(/^bq\.\s+/gm, '> ')
.replace(/\{color:[^}]+\}([^]*)\{color\}/gm, '$1')
.replace(/\{panel:title=([^}]*)\}\n?([^]*?)\n?\{panel\}/gm, '\n| $1 |\n| --- |\n| $2 |')
.replace(/^[ \t]*((?:\|\|.*?)+\|\|)[ \t]*$/gm, (match, headers) => {

Check failure

Code scanning / CodeQL

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings starting with '||' and containing many repetitions of '||'.

return str
.replace(
/^\n((?:\|.*?)+\|)[ \t]*\n((?:\|\s*?-{3,}\s*?)+\|)[ \t]*\n((?:(?:\|.*?)+\|[ \t]*\n)*)$/gm,

Check failure

Code scanning / CodeQL

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings starting with '\n|' and containing many repetitions of '|'.

return str
.replace(
/^\n((?:\|.*?)+\|)[ \t]*\n((?:\|\s*?-{3,}\s*?)+\|)[ \t]*\n((?:(?:\|.*?)+\|[ \t]*\n)*)$/gm,

Check failure

Code scanning / CodeQL

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '|'.
@codecov-commenter
Copy link

Codecov Report

Merging #415 (889da5e) into main (a51e5e1) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #415   +/-   ##
=======================================
  Coverage   46.35%   46.35%           
=======================================
  Files         139      139           
  Lines       11776    11776           
=======================================
  Hits         5459     5459           
  Misses       6176     6176           
  Partials      141      141           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ricoberger ricoberger merged commit bbf3ac8 into main Aug 22, 2022
@ricoberger ricoberger deleted the jira-convert-description-to-markdown branch August 22, 2022 17:34
@ricoberger ricoberger added the changelog: changed Something was changed or updated label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: changed Something was changed or updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants