Skip to main content

Introduces a new syntax to Markdown for generating HTML ruby tags

Project description

lektor-markdown-ruby-blocks

This is a simple Lektor plugin that adds support for HTML ruby tags to Markdown.

Syntax

To create a ruby tag, use the following ruby-block syntax:

^^
(歩)[ある]く
^^

This will generate the following HTML:

<span class="ruby-line">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>

The rendering result:

歩(ある)く

You can combine adjacent ruby text like this:

^^
(自|分)[じ|ぶん]
^^

And this will be rendered like this:

<span class="ruby-line">
  <ruby><rp>(</rp><rt></rt><rp>)</rp></ruby>
  <ruby><rp>(</rp><rt>ぶん</rt><rp>)</rp></ruby>
</span>

Rendered output:

自(じ) 分(ぶん)

Newline

This plugin will automatically add <br /> between each line in a ruby-block:

^^
(歩)[ある]く
(歩)[ある]く
^^

This will output:

<span class="ruby-line">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>
<br />
<span class="ruby-line">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>

You can also use -##- to create an extra newline in a ruby-block.

^^
(歩)[ある]く
-##-
(歩)[ある]く
^^

Output:

<span class="ruby-line">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>
<br />
<br />
<span class="ruby-line">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>

Coloring the text

Additionally, you can add a 6-digit or 8-digit hex RGB code after the beginning ^^, making the rendered content colored with specified color.

^^#44cc00
(歩)[ある]く
^^

This will generate the following HTML pieces:

<span class="ruby-line" style="color: #44cc00">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>

Raw lines

Prepend %  to create a raw line. Raw lines are not converted to ruby tags, not affected by the color settings, and have a different class.

Example:

^^#44cc00
(歩)[ある]く
% (aru)[ku]
^^

Output:

<span class="ruby-line" style="color: #44cc00">
  <ruby><rp>(</rp><rt>ある</rt><rp>)</rp></ruby></span>
<br />
<span class="non-ruby-line">
  (aru)[ku]
</span>

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

lektor_markdown_ruby_blocks-0.2.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

lektor_markdown_ruby_blocks-0.2.4-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file lektor_markdown_ruby_blocks-0.2.4.tar.gz.

File metadata

File hashes

Hashes for lektor_markdown_ruby_blocks-0.2.4.tar.gz
Algorithm Hash digest
SHA256 723338b2ca4cf315d54d0659f00234bed9e9323e857359a787eb9a5610814d7e
MD5 8ecc612e3645b786e14b596269fa18a9
BLAKE2b-256 a030b4c37cead313ee288cbe5fc0408a1d2a51834adf4d5f99932e2082938139

See more details on using hashes here.

File details

Details for the file lektor_markdown_ruby_blocks-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lektor_markdown_ruby_blocks-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d587a4df1a8039795a8442afddcc51bf4562fdd3e047a90ff746eb17bddb02f8
MD5 4466aaa3ae8869b7837deab9bd65c6e1
BLAKE2b-256 1f9d62e21bab0d40e40a237ce3da375a9a78b3abe067f9c03594c7a7f9bd7539

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