Skip to main content

Python-Markdown extension for DenDenMarkdown

Project description

denden_extension

Denden_extension is a Python-Markdown extension enables DenDenMarkdown syntax in Python-Markdown.

Requirement

Python-Markdown >= 3.0.0, < 3.1

Install

pip install denden_extension

Usage

Designate denden_extension as extension with other extensions when you use the Python-Markdown.

>>> import markdown
>>> from denden_extension import DenDenExtension
>>> markdown_text = '{電子出版|でんししゅっぱん}を手軽に'
>>> html_text = markdown.markdown(markdown_text, extensions=['markdown.extensions.extra', 'markdown.extensions.nl2br', 'markdown.extensions.sane_lists', DenDenExtension()])
>>> html_text
'<p><ruby>電子出版<rt>でんししゅっぱん</rt></ruby>を手軽に</p>'

or

>>> import markdown
>>> from denden_extension import DenDenExtension
>>> markdown.markdownFromFile(
...             input='markdown_text.md',
...             output='html_text.html',
...             encoding='utf-8',
...             extensions=['markdown.extensions.extra', 'markdown.extensions.nl2br', 'markdown.extensions.sane_lists', DenDenExtension()],
...             )

or

python -m markdown -x markdown.extensions.extra -x markdown.extensions.nl2br -x markdown.extensions.sane_lists -x denden_extension markdown_text.md > html_text.html

For more details of usage of Python-Markdown, see Python-Markdown documentation.

Options

You can disable some features of denden_extension.

Disable Chunk file syntax:

>>> html_text = markdown.markdown(markdown_text, extensions=['markdown.extensions.extra', 'markdown.extensions.nl2br', 'markdown.extensions.sane_lists', DenDenExtension(docbreak=False)])

Disable Footnotes with epub:type attribute:

>>> html_text = markdown.markdown(markdown_text, extensions=['markdown.extensions.extra', 'markdown.extensions.nl2br', 'markdown.extensions.sane_lists', DenDenExtension(footnote=False)])

If you run the Python-Markdown from command line with an extension with options, you need to prepare the configuration file. For more details, see Python-Markdown documentation.

Description

DenDenMarkdown is an extended Markdown syntax fitted for Japanese and EPUB publishing.
Denden_extension enables the following DenDenMarkdown syntax in Python-Markdown.

*1 Denden_extension depends on the Python-Markdown's footnotes extension for implementing this feature. So you also need the markdown.extensions.footnotes or markdown.extensions.extra which includes the footnotes extension.
*2 Three or more equal signs ('=') on a line by themselves is replaced by a horizontal rule tag with docbreak class attribute (<hr class="docbreak" />).

DenDenMarkdown inherits its syntax from PHP Markdown Extra. In Python-Markdown, PHP Markdown Extra syntax is enabled by markdown.extensions.extra and markdown.extensions.sane_lists, which are included in the Python-Markdown Library.
Also, DenDenMarkdown adopts GFM style line break. This can be enabled by markdown.extensions.nl2br, which is included with the Python-Markdown too.

If you only want to use DenDenMarkdown's original syntax, you just need to designate only markdown.extensions.footnotes and denden_extension.
If you don't use footnotes, only denden_extension is necessary.

The following syntax of DenDenMarkdown is not implemented in denden_extension.

  • Twitter account autolink syntax

For more details of DenDenMarkdown syntax, see http://conv.denshochan.com/markdown (Japanese).

Change log

  • 2.0 (2020-12-21) -- suport only Python-Markdown >= 3.0.0, < 3.1 and Python3
  • 1.0 (2016-04-29) -- formal release
  • 0.1 (2015-08-23) -- first experimental release

Contact

Contact form

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

denden_extension-2.0.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

denden_extension-2.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file denden_extension-2.0.0.tar.gz.

File metadata

  • Download URL: denden_extension-2.0.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for denden_extension-2.0.0.tar.gz
Algorithm Hash digest
SHA256 88e802860a987ea31fafc0594356f338f71ee2541be73b3a6d18dae418429904
MD5 0c1ced96df61fd86609b3331beff00fa
BLAKE2b-256 4b77257dca6dddcfcc6d454f7348ae22b896dc104533a94a01d26562dcbe49d2

See more details on using hashes here.

File details

Details for the file denden_extension-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: denden_extension-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for denden_extension-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 442c4e9544f4a37a3acb2432ca6cbeaa06afac7fb204d1e5edb14cfe7def1a1a
MD5 43efd2eff6902b1d216bb7368d719041
BLAKE2b-256 c93f7faba1929b3de4b1e350fbd20a05f9c399717dd9fea6433a67ca90dc559f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page