Skip to content

Commit

Permalink
Merge pull request #14 from razroo/ZETA-8715-no-format-logic
Browse files Browse the repository at this point in the history
[ZETA-8715]: Update the {noformat} logic so converted to code
  • Loading branch information
CharlieGreenman authored May 9, 2024
2 parents 963176a + 147b4e2 commit 1c73494
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/__tests__/jm-to-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ Notes:
1. Will be within the importJiraTickets function`;
expect(result).toEqual(expected);
});

it('should convert jira markdown with special curly braces to markdown', () => {
const jiraMarkdown = "{noformat}Scenario We are not sure whether or not scheduling via close is a users local time on their computer or via timezone in close.com system\n Given I am Henry \n And I am acting on behalf of Charlie Greenman\n When I use Charlie Greenman's Close.com account \n And Send out an email via send later\n Then It should send an email at the expected time{noformat}\n\nNotes: \n\n# I will send an email to my email address 10 minutes later than the current time to test. Feel free to use this method to test. Once receive email can mark this ticket as complete"
const result = convertJiraMarkdownToRegularMarkdown(jiraMarkdown);
const expected = `\`\`\`Scenario We are not sure whether or not scheduling via close is a users local time on their computer or via timezone in close.com system
Given I am Henry
And I am acting on behalf of Charlie Greenman
When I use Charlie Greenman's Close.com account
And Send out an email via send later
Then It should send an email at the expected time\`\`\`
Notes:
1. I will send an email to my email address 10 minutes later than the current time to test. Feel free to use this method to test. Once receive email can mark this ticket as complete`;
expect(result).toEqual(expected);
});
});

describe('convertJiraMarkdownToHtml', () => {
Expand Down
1 change: 1 addition & 0 deletions src/jm-to-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function convertJiraMarkdownToRegularMarkdown(jiraMarkdown: string): stri
/\{code(:([a-z]+))?([:|]?(title|borderStyle|borderColor|borderWidth|bgColor|titleBGColor)=.+?)*\}([^]*?)\n?\{code\}/gm,
'```$2$5\n```'
)
.replace(/\{noformat\}/g, '```')
}

export async function convertJiraMarkdownToHtml(jiraMarkdown: string): Promise<string> {
Expand Down

0 comments on commit 1c73494

Please sign in to comment.