Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
'

嗯。就酱

'