Skip to main content

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for markdown-cjk-spacing, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size markdown_cjk_spacing-0.2.2-py3-none-any.whl (5.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size markdown_cjk_spacing-0.2.2.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page