https://github.com/proxzima/string_to_markdown_id
Convert string to GitLab Flavored Markdown Header ID
https://github.com/proxzima/string_to_markdown_id
glfm markdown python python-package
Last synced: about 2 months ago
JSON representation
Convert string to GitLab Flavored Markdown Header ID
- Host: GitHub
- URL: https://github.com/proxzima/string_to_markdown_id
- Owner: PROxZIMA
- License: mit
- Created: 2022-07-26T15:09:58.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-26T15:23:38.000Z (almost 4 years ago)
- Last Synced: 2024-04-29T02:22:30.779Z (about 2 years ago)
- Topics: glfm, markdown, python, python-package
- Language: HTML
- Homepage: https://proxzima.dev/string_to_markdown_id
- Size: 221 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- License: License
Awesome Lists containing this project
README
String to Markdown Id
#####################
.. image:: https://readthedocs.org/projects/string-to-markdown-id/badge/?version=latest
:target: https://string-to-markdown-id.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Convert string to GitLab Flavored Markdown Header ID `[1] `_
Quickstart
==========
String to Markdown Id is available on PyPI and can be installed with `pip `_.
.. code-block:: console
$ pip install string_to_markdown_id
After installing String to Markdown Id you can use it like any other Python module.
Here is a simple example:
.. code-block:: python
from string_to_markdown_id import convertToMarkdownId
testQueries = [
r"""(This) --- --v - " "" ' ' has 2.5, π, νκΈ, :thumbsup:, , \n, \r, \t, \f, \u, \a, \x, \\t""",
"this-------v-------has-25--νκΈ-thumbsup--n-r-t-f-u-a-x-t",
]
expected = [
"this-v-has-25-νκΈ-thumbsup-n-r-t-f-u-a-x-t",
"this-v-has-25-νκΈ-thumbsup-n-r-t-f-u-a-x-t-1",
]
expectedHyphenIgnore = [
"this-------v-------has-25--νκΈ-thumbsup--n-r-t-f-u-a-x-t",
"this-------v-------has-25--νκΈ-thumbsup--n-r-t-f-u-a-x-t-1",
]
print(f"\nGiven queries:\n{testQueries}\n")
gens = convertToMarkdownId(testQueries)
print(f"Generated IDs:\n{gens}\n")
print(f"Expected IDs:\n{expected}\n")
gens = convertToMarkdownId(testQueries, ignore_multi_hyphens=True)
print(f"Generated IDs (Hyphen Ignored):\n{gens}\n")
print(f"Expected IDs (Hyphen Ignored):\n{expectedHyphenIgnore}\n")
The `API Reference `_ provides API-level documentation.