# Marko: `fenced_divs`
This is an extension for [Marko](https://marko-py.readthedocs.io/) providing support
for [fenced divs as detailed by pandoc](https://pandoc.org/demo/example33/8.18-divs-and-spans.html).
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:
```markdown
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.
```markdown
# 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.
```markdown
# 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.
```python
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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "roamkit-marko-fenced-divs",
"maintainer": "Kevin Wetzels",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Kevin Wetzels <kevin@roam.be>",
"keywords": "markdown marko fenced",
"author": "Kevin Wetzels",
"author_email": "Kevin Wetzels <kevin@roam.be>",
"download_url": "https://files.pythonhosted.org/packages/98/b4/d8d9e3e8c46a09bb7ce9ade467bf98c710c4ecfad2afb9f04cd5e56afff4/roamkit_marko_fenced_divs-1.0.0.tar.gz",
"platform": null,
"description": "# Marko: `fenced_divs`\n\nThis is an extension for [Marko](https://marko-py.readthedocs.io/) providing support\nfor [fenced divs as detailed by pandoc](https://pandoc.org/demo/example33/8.18-divs-and-spans.html).\n\nIt allows you to wrap parts of the Markdown text in a div or other html element without having\nto resort to html directly.\n\nLike this:\n\n```markdown\nJust plain Markdown here, followed by a `fenced div`.\n\n:::wrapper\nThis _will_ be wrapped.\n:::\n\nAnd continue doing your thing down here.\n```\n\nYou can use a many colons as you want. And yes, you can nest.\n\n## Examples\n\n### Simple\nThe text after the opening colons is used as the `class` attribute\nfor the div.\n\n```markdown\n# A title\nSome text in a paragraph.\n\n:::className\nAll of this will be wrapped in a `<div class=\"className\">`.\n\nYes, even this list:\n\n1. First\n2. Second\n:::\n\nAnd this will just be another paragraph.\n```\n\n### With attributes\nIf you need more control, you can specify attributes explicitly by wrapping\nthem in curly braces.\n\n```markdown\n# A title\nSome text in a paragraph.\n\n::: { #my-id .something active=\"true\" <section> }\nAll of this will be wrapped in a \n`<section id=\"my-id\" class=\"className\" active=\"true\">`.\n\nYes, even this list:\n\n1. First\n2. Second\n:::\n\nAnd this will just be another paragraph.\n```\n\n## Usage\n\n1. Install `roamkit-marko-fenced-divs` from Pypi.\n2. Add `roamkit.marko.fenced_divs` as an extension.\n\n```python\nfrom marko import Markdown\n\n\ndef convert_to_html(md_text: str) -> str:\n # codehilite is just an example of another extension.\n engine = Markdown(\n extensions=[\"roamkit.marko.fenced_divs\", \"codehilite\"],\n )\n return engine.convert(md_text)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Fenced divs extension for Marko",
"version": "1.0.0",
"project_urls": {
"Repository": "https://github.com/roam/roamkit-marko-fenced-divs"
},
"split_keywords": [
"markdown",
"marko",
"fenced"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d744c948cfbeadb73184e9c42e8878d8bf75ac0114d3329c9ef299ecc3c34fe4",
"md5": "93b9a8e06fed00ea2fcfd5def5ec5f77",
"sha256": "b78d67750abea646741fa86321124dd7f72992d3be7a55646db458f566a72979"
},
"downloads": -1,
"filename": "roamkit_marko_fenced_divs-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "93b9a8e06fed00ea2fcfd5def5ec5f77",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5261,
"upload_time": "2025-09-12T17:13:41",
"upload_time_iso_8601": "2025-09-12T17:13:41.456699Z",
"url": "https://files.pythonhosted.org/packages/d7/44/c948cfbeadb73184e9c42e8878d8bf75ac0114d3329c9ef299ecc3c34fe4/roamkit_marko_fenced_divs-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "98b4d8d9e3e8c46a09bb7ce9ade467bf98c710c4ecfad2afb9f04cd5e56afff4",
"md5": "a165c2aea2bfe61f3e549118e6644687",
"sha256": "b148ef34e6828e60d4d1931980886d42367548d22fbc8e7841a4edca0724e00c"
},
"downloads": -1,
"filename": "roamkit_marko_fenced_divs-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a165c2aea2bfe61f3e549118e6644687",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 4007,
"upload_time": "2025-09-12T17:13:42",
"upload_time_iso_8601": "2025-09-12T17:13:42.683245Z",
"url": "https://files.pythonhosted.org/packages/98/b4/d8d9e3e8c46a09bb7ce9ade467bf98c710c4ecfad2afb9f04cd5e56afff4/roamkit_marko_fenced_divs-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-12 17:13:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "roam",
"github_project": "roamkit-marko-fenced-divs",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "roamkit-marko-fenced-divs"
}