Skip to content
master
Switch branches/tags
Code
This branch is 7 commits ahead, 1 commit behind EloiseSeverin:master.
Contribute

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

build

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")

About

Python markdown extension for insert a space between Chinese / Japanese / Korean and English words, to display beautifully.

Resources

License

Releases

No releases published

Packages

No packages published