Skip to main content

A package to convert HTML to Jira Wiki Markup

Project description

HTML to Jira Wiki Markup Converter

PyPI version License: MIT

A Python package that converts HTML content to Jira Wiki Markup format. It supports various HTML elements including headers, paragraphs, lists, links, tables, inline styles, and images within table cells.

Features

  • Converts HTML headers (<h1>, <h2>, <h3>) to Jira Wiki headers.
  • Converts paragraphs (<p>) and inline text styles (<em>, <strong>, <span style="color">).
  • Converts unordered lists (<ul>) and ordered lists (<ol>) to Jira Wiki lists.
  • Converts links (<a>) to Jira Wiki link format.
  • Converts tables (<table>, <tr>, <th>, <td>) to Jira Wiki table format.
  • Supports images (<img>) within table cells.

Installation

You can install the package via pip:

pip install html-to-jira

Usage

Converting HTML to Jira Wiki Markup

You can use the html_to_jira function from the html_to_jira package to convert your HTML content to Jira Wiki Markup.

from html_to_jira.converter import html_to_jira

html_string = '''
<h1>Welcome to Jira!</h1>
<p>This is a <em>sample</em> HTML string with <strong>bold</strong> text and <span style="color:red;">colored text</span>.</p>
<ul>
  <li>Item 1 with <strong>bold</strong> text</li>
  <li>Item 2 with <span style="color:blue;">colored text</span></li>
</ul>
<ol>
  <li>First with <em>italic</em> text</li>
  <li>Second with <span style="color:green;">green text</span></li>
</ol>
<p>Visit <a href="https://example.com">this link</a> for more information.</p>
<table>
  <tr>
    <th>Heading 1</th>
    <th>Heading 2</th>
  </tr>
  <tr>
    <td>Col A1 with <strong>bold</strong> text</td>
    <td>Col A2 with <span style="color:purple;">purple text</span> and <img src="https://example.com/image.png" alt="Example Image"></td>
  </tr>
</table>
'''

jira_markup = html_to_jira(html_string)
print(jira_markup)

Example Output

h1. Welcome to Jira!

This is a _sample_ HTML string with *bold* text and {color:red}colored text{color}.

* Item 1 with *bold* text
* Item 2 with {color:blue}colored text{color}

# First with _italic_ text
# Second with {color:green}green text{color}

Visit [this link|https://example.com] for more information.

||Heading 1|Heading 2||
|Col A1 with *bold* text|Col A2 with {color:purple}purple text{color} and !https://example.com/image.png|alt=Example Image!|

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

html_to_jira-0.1.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

html_to_jira-0.1.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page