|
1 | 1 | # Html To ADF
|
2 |
| -Used to convert Atlassian Document Format from ADF to html and also from |
3 |
| -html to adf |
| 2 | +Used to convert from Atlassian Document Format(ADF) and also from |
| 3 | +html to ADF. In addition, allows to convert from Jira Markdown to |
| 4 | +regular markdown. |
4 | 5 |
|
5 | 6 | # How to install
|
6 | 7 | ```
|
7 | 8 | npm install @razroo/html-to-adf --save
|
8 | 9 | ```
|
9 | 10 |
|
10 |
| -## Two main functions |
| 11 | +## HTML to ADF + ADF to HTML |
11 | 12 |
|
12 | 13 | ### convertHtmlToADF
|
13 | 14 |
|
@@ -82,4 +83,48 @@ it('should convert a simple paragraph with bold', () => {
|
82 | 83 | const expected = `<p>test <b>this</b></p>`;
|
83 | 84 | expect(result).toEqual(expected);
|
84 | 85 | });
|
| 86 | +``` |
| 87 | + |
| 88 | +## Convert Jira Markdown to Markdown or HTML |
| 89 | + |
| 90 | +### Convert Jira Markdown to Markdown |
| 91 | +```ts |
| 92 | +it('should convert jira markdown to regular markdown', () => { |
| 93 | + const jiraMarkdown = "*Feature*: Convert Jira ticket ADF description to HTML\n\nScenario: User converts Jira ticket ADF to HTML\nGiven that I have a Jira ticket ADF description\nWhen I initiate the conversion process\n And use the importJiraTicket function\nThen the ADF description is successfully converted to HTML\n\nNotes: \n\n# Will use the function here: [https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml|https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml|smart-link] \n# Will be within the importJiraTickets function"; |
| 94 | + const result = convertJiraMarkdownToRegularMarkdown(jiraMarkdown); |
| 95 | + const expected = `**Feature**: Convert Jira ticket ADF description to HTML |
| 96 | +
|
| 97 | +Scenario: User converts Jira ticket ADF to HTML |
| 98 | +Given that I have a Jira ticket ADF description |
| 99 | +When I initiate the conversion process |
| 100 | + And use the importJiraTicket function |
| 101 | +Then the ADF description is successfully converted to HTML |
| 102 | +
|
| 103 | +Notes: |
| 104 | +
|
| 105 | +1. Will use the function here: [https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml](https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml) |
| 106 | +1. Will be within the importJiraTickets function`; |
| 107 | +expect(result).toEqual(expected); |
| 108 | +}); |
| 109 | +``` |
| 110 | + |
| 111 | +### Convert Jira Markdown to HTML |
| 112 | +```ts |
| 113 | +it('should convert jira markdown to html', async() => { |
| 114 | + const jiraMarkdown = "*Feature*: Convert Jira ticket ADF description to HTML\n\nScenario: User converts Jira ticket ADF to HTML\nGiven that I have a Jira ticket ADF description\nWhen I initiate the conversion process\n And use the importJiraTicket function\nThen the ADF description is successfully converted to HTML\n\nNotes: \n\n# Will use the function here: [https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml|https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml|smart-link] \n# Will be within the importJiraTickets function"; |
| 115 | + const result = await convertJiraMarkdownToHtml(jiraMarkdown); |
| 116 | + const expected = `<p><strong>Feature</strong>: Convert Jira ticket ADF description to HTML</p> |
| 117 | +<p>Scenario: User converts Jira ticket ADF to HTML |
| 118 | +Given that I have a Jira ticket ADF description |
| 119 | +When I initiate the conversion process |
| 120 | + And use the importJiraTicket function |
| 121 | +Then the ADF description is successfully converted to HTML</p> |
| 122 | +<p>Notes: </p> |
| 123 | +<ol> |
| 124 | +<li>Will use the function here: <a href="https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml">https://github.com/razroo/html-to-adf?tab=readme-ov-file#convertadftohtml</a> </li> |
| 125 | +<li>Will be within the importJiraTickets function</li> |
| 126 | +</ol> |
| 127 | +`; |
| 128 | + expect(result).toEqual(expected); |
| 129 | + }); |
85 | 130 | ```
|
0 commit comments