Add supports to ruby blocks syntax in Markdown
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
Built Distribution
Hashes for lektor_markdown_ruby_blocks-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0aadcb3eaa5ae119bc3d3669fa728d96e3e68322623c6746224293a60563163 |
|
MD5 | 6077feca8a24c0746e6b6d6a5bd652e5 |
|
BLAKE2b-256 | 3f342fde7bbb0cbbff2c6256099dc2717fb3cc01c262b41bcd86bbc8e37c4715 |
Hashes for lektor_markdown_ruby_blocks-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ca137e4ced4fb6f5f242ae2bac72f131fe44b81190b30316cafd530e78ab6b7 |
|
MD5 | 487f8c5964120a1ec91c4a2f06c289f2 |
|
BLAKE2b-256 | 796122654da6698675497680c6ae86690cbe1c15d6c90e5c58adf286111d5928 |