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-1.0.0.tar.gz (4.0 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-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for roamkit_marko_fenced_divs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b148ef34e6828e60d4d1931980886d42367548d22fbc8e7841a4edca0724e00c
MD5 a165c2aea2bfe61f3e549118e6644687
BLAKE2b-256 98b4d8d9e3e8c46a09bb7ce9ade467bf98c710c4ecfad2afb9f04cd5e56afff4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for roamkit_marko_fenced_divs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b78d67750abea646741fa86321124dd7f72992d3be7a55646db458f566a72979
MD5 93b9a8e06fed00ea2fcfd5def5ec5f77
BLAKE2b-256 d744c948cfbeadb73184e9c42e8878d8bf75ac0114d3329c9ef299ecc3c34fe4

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