Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tylertemp/md-nlcontinuous
Python Markdown extension which do not add space after line break in Chinese
https://github.com/tylertemp/md-nlcontinuous
Last synced: about 2 months ago
JSON representation
Python Markdown extension which do not add space after line break in Chinese
- Host: GitHub
- URL: https://github.com/tylertemp/md-nlcontinuous
- Owner: TylerTemp
- License: mit
- Created: 2016-01-10T11:16:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-04T15:56:54.000Z (almost 9 years ago)
- Last Synced: 2023-02-26T15:22:36.046Z (almost 2 years ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
.. md-nlcontinuous
.. README.rstmd-nlcontinuous
===============Python Markdown extension which prevents white space after line break in Chinese
Install
-------.. code:: bash
pip install git+git://github.com/TylerTemp/md-nlcontinuous.git
Usage
-----.. code:: python
import markdown
import nlcontinuous
s = '中文\n中文'
print(markdown.markdown(s, extensions=[nlcontinuous.makeExtension()])
#中文中文
By default markdown will keep the line breaker (`\n`), which is not neccessary
in Chinese.`nlcontinuous` will remove that space, but keep it when it's not Chinese.
.. code:: python
>>> s = '中文\n中文'
>>> markdown.markdown(s)
'中文\n中文
'
>>> markdown.markdown(s, extensions=[nlcontinuous.makeExtension()])
'中文中文
'
>>> markdown.markdown('中文\nEnglish', extensions=[nlcontinuous.makeExtension()])
'中文\nEnglish
'
>>> markdown.markdown('嗯。\n就酱', extensions=[nlcontinuous.makeExtension()]) # zh-punctuation
'嗯。就酱
'