Skip to main content

Fenced divs extension for Marko

Project description

Marko: fenced_divs

This is an extension for Marko providing support for fenced divs as detailed by pandoc.

It allows you to wrap parts of the Markdown text in a div or other html element without having to resort to html directly.

Like this:

Just plain Markdown here, followed by a `fenced div`.

:::wrapper
This _will_ be wrapped.
:::

And continue doing your thing down here.

You can use a many colons as you want. And yes, you can nest.

Examples

Simple

The text after the opening colons is used as the class attribute for the div.

# A title
Some text in a paragraph.

:::className
All of this will be wrapped in a `<div class="className">`.

Yes, even this list:

1. First
2. Second
:::

And this will just be another paragraph.

With attributes

If you need more control, you can specify attributes explicitly by wrapping them in curly braces.

# A title
Some text in a paragraph.

::: { #my-id .something active="true" <section> }
All of this will be wrapped in a 
`<section id="my-id" class="className" active="true">`.

Yes, even this list:

1. First
2. Second
:::

And this will just be another paragraph.

Usage

  1. Install roamkit-marko-fenced-divs from Pypi.
  2. Add roamkit.marko.fenced_divs as an extension.
from marko import Markdown


def convert_to_html(md_text: str) -> str:
    # codehilite is just an example of another extension.
    engine = Markdown(
        extensions=["roamkit.marko.fenced_divs", "codehilite"],
    )
    return engine.convert(md_text)

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

roamkit_marko_fenced_divs-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

roamkit_marko_fenced_divs-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file roamkit_marko_fenced_divs-0.1.0.tar.gz.

File metadata

File hashes

Hashes for roamkit_marko_fenced_divs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39c37b1ab04912b5d83a4edcf88c3955a65da7853c8db06d947bb8e561534532
MD5 e80b9836a0b6fa04ecad7081cf699afc
BLAKE2b-256 2d768655f7d4d9d5e9a1dcfff9778c6413d6f818a8ceb4e553f75479b116c451

See more details on using hashes here.

File details

Details for the file roamkit_marko_fenced_divs-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for roamkit_marko_fenced_divs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bce73a1f421ccfbaf89464ae8290c51ac4e99cde5f47dd97ec079fe56c9d46
MD5 dba9167ad4fc91a07f5e978e879a9e1d
BLAKE2b-256 fadec469781e2c27e02689209f16967705750c3fb38f9f2a54313d5e91958c47

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