Python markdown extension for insert a space between Chinese / Japanese / Korean and English words
Project description
markdown_cjk_spacing
Python markdown extension for insert a space between Chinese / Japanese / Korean and English words, to display beautifully.
中文Chinese西文English
is converted to 中文 Chinese 西文 English
.
Installation
Install with pip.
$ pip install markdown-cjk-spacing
Usage
It is used as an extension of Python-Markdown.
import markdown
md = markdown.Markdown(extensions=["markdown_cjk_spacing.cjk_spacing"])
md.convert("markdown text")
Or use from Pelican as Markdown extension.
# pelicanconf.py
MARKDOWN = {
'extension_configs': {
'markdown.extensions.codehilite': {'css_class': 'highlight'},
'markdown.extensions.extra': {},
'markdown.extensions.meta': {},
'markdown_cjk_spacing.cjk_spacing': {},
},
'output_format': 'html5',
}
Segment split conversion
In Chinese / Japanese sentences, if you do a line feed, it will be a one-byte space, but you can delete this space.
import markdown
md = markdown.Markdown(extensions=["markdown_cjk_spacing.cjk_spacing"],
extension_configs={'markdown_cjk_spacing.cjk_spacing':
{'segment_break': True}})
md.convert("markdown text")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for markdown_cjk_spacing-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5366dd9673d0a095cc6bc483c2efcdd0b5ccc1ebf988429f39e800d663dde20d |
|
MD5 | 59e7bed73ace2aaa757e91bfd14d3092 |
|
BLAKE2b-256 | c4d0676a06288572f3a2a41a7348e1da6543b16796f0973db43278bfed1e1333 |
Close
Hashes for markdown_cjk_spacing-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6c228e6b08ce75fd8a9fb1b0b010e742b258112da0e17de3d2d46cca6b43e10 |
|
MD5 | bf14a5f3bd39ecdbfbe120ced5e3cfd1 |
|
BLAKE2b-256 | 068760b2f581bb671d3e021f18407e5ac8c85cc6af1d630931e33ad4f07f9497 |