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: 6 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 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-04T15:56:54.000Z (almost 10 years ago)
- Last Synced: 2025-05-23T22:39:27.120Z (6 months 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.rst
md-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
'嗯。就酱
'