Name | mrkdwnify JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | Python adaptation of the javascript html-to-mrkdwn library. |
upload_time | 2024-11-18 01:48:28 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT License Copyright (c) 2024 bengelb-io Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
converter
html
html-to-mrkdwn
markdown
markdownify
mrkdwn
python
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# mrkdwnify
mrkdwnify is an adaptation of the javascript html-to-mrkdwn library.
There are some small implementation differences between html-to-mrkdwn and mrkdwnify.
If you don't know what mrkdwn is, it's a subset of Markdown made by Slack, to enable users to craft nicely formatted messages on their platform.
Do not use this if you're looking for a regular html to markdown parser. Try: https://github.com/matthewwithanm/python-markdownify
`mrkdwnify` itself is derived directly from the python-markdownify library.
It overrides several methods from the original library and passes option presets to make outputs compatible with the mrkdwn spec.
1. Consecutive <a> and <img> are not treated as inline elements.
2. For "checked" attributes in input tags you need to provide a "true" value
Ex:
```<li class="task-list-item"><input class="task-list-item-checkbox" type="checkbox" checked="true">item</li>``` => ☑︎ item
Other than that the implementation should be the same.
Important things to note:
- ```<table>``` elements will not be rendered at all (not even their content) unless you pass `render_tables=True` as a keyword argument.
# Installation
Until I can figure out PyPi:
```bash
pip install git+https://github.com/bengelb-io/py-html-to-mrkdwn
```
# Use
```python
from mrkdwnify import mrkdwnify
html = "<h1>Hello this is a mrkdwn header!</h1>"
mrkdwn = mrkdwnify(html) # *Hello this is a mrkdwn header!*
html = '<p>Hello this is an inline link! <a href="https://www.example.com">Example</a></p>'
mrkdwn = mrkdwnify(html) # Hello this is an inline link! <https://www.example.com|Example>
```
Raw data
{
"_id": null,
"home_page": null,
"name": "mrkdwnify",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "converter, html, html-to-mrkdwn, markdown, markdownify, mrkdwn, python",
"author": null,
"author_email": "Benjamin Gelb <benjamin.gelb.io@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b1/a3/5d34a289cb10dd64472a4c6930a48791ae4bbc575b1588bf890ba5fbf898/mrkdwnify-0.1.1.tar.gz",
"platform": null,
"description": "# mrkdwnify\n\nmrkdwnify is an adaptation of the javascript html-to-mrkdwn library.\nThere are some small implementation differences between html-to-mrkdwn and mrkdwnify.\n\nIf you don't know what mrkdwn is, it's a subset of Markdown made by Slack, to enable users to craft nicely formatted messages on their platform.\nDo not use this if you're looking for a regular html to markdown parser. Try: https://github.com/matthewwithanm/python-markdownify\n\n`mrkdwnify` itself is derived directly from the python-markdownify library.\nIt overrides several methods from the original library and passes option presets to make outputs compatible with the mrkdwn spec.\n\n1. Consecutive <a> and <img> are not treated as inline elements.\n2. For \"checked\" attributes in input tags you need to provide a \"true\" value\n\nEx:\n```<li class=\"task-list-item\"><input class=\"task-list-item-checkbox\" type=\"checkbox\" checked=\"true\">item</li>``` => \u2611\ufe0e item\n\nOther than that the implementation should be the same.\n\nImportant things to note:\n- ```<table>``` elements will not be rendered at all (not even their content) unless you pass `render_tables=True` as a keyword argument.\n\n# Installation \nUntil I can figure out PyPi:\n```bash\npip install git+https://github.com/bengelb-io/py-html-to-mrkdwn\n```\n\n# Use\n\n```python\nfrom mrkdwnify import mrkdwnify\n\nhtml = \"<h1>Hello this is a mrkdwn header!</h1>\"\nmrkdwn = mrkdwnify(html) # *Hello this is a mrkdwn header!*\n\nhtml = '<p>Hello this is an inline link! <a href=\"https://www.example.com\">Example</a></p>'\nmrkdwn = mrkdwnify(html) # Hello this is an inline link! <https://www.example.com|Example>\n```",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 bengelb-io Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Python adaptation of the javascript html-to-mrkdwn library.",
"version": "0.1.1",
"project_urls": {
"Bug Tracker": "https://github.com/bengelb-io/mrkdwnify/issues",
"Homepage": "https://github.com/bengelb-io/mrkdwnify"
},
"split_keywords": [
"converter",
" html",
" html-to-mrkdwn",
" markdown",
" markdownify",
" mrkdwn",
" python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "03136609c7f92c128ca02d607300db381dc157625bad39916b55b33052184f8e",
"md5": "2e5c419ba4c2d33444ee3afa64ba9592",
"sha256": "a7637720cf0118b46daa36d4c3ccfc961b66aa57e59cdb29a71c8f8f131c7571"
},
"downloads": -1,
"filename": "mrkdwnify-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e5c419ba4c2d33444ee3afa64ba9592",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5068,
"upload_time": "2024-11-18T01:48:27",
"upload_time_iso_8601": "2024-11-18T01:48:27.116648Z",
"url": "https://files.pythonhosted.org/packages/03/13/6609c7f92c128ca02d607300db381dc157625bad39916b55b33052184f8e/mrkdwnify-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b1a35d34a289cb10dd64472a4c6930a48791ae4bbc575b1588bf890ba5fbf898",
"md5": "cdc682ad1bd3cccfe04f25622f2329a5",
"sha256": "3f6ab9c561e1939204a1d3c57e587bcf2b5329ac0971085eee5854aa3822d727"
},
"downloads": -1,
"filename": "mrkdwnify-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "cdc682ad1bd3cccfe04f25622f2329a5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6589,
"upload_time": "2024-11-18T01:48:28",
"upload_time_iso_8601": "2024-11-18T01:48:28.750471Z",
"url": "https://files.pythonhosted.org/packages/b1/a3/5d34a289cb10dd64472a4c6930a48791ae4bbc575b1588bf890ba5fbf898/mrkdwnify-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 01:48:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bengelb-io",
"github_project": "mrkdwnify",
"github_not_found": true,
"lcname": "mrkdwnify"
}