Skip to main content
# Structured-Markdown
I love markdown, but I've always wanted to use it to write more than just "flat" documents.
Structured Markdown is an extension to markdown syntax that allows for nesting and (eventually) styling within one document.
So, how does it work?

## Overview
SMD is currently a python module that, when given a Structured Markdown (SMD) file, will produce a formatted html string.
Currently, the module uses mistune to parse the markdown - the parsing, however is down by this.
The general idea is that a static site could use these easy-to-write SMD files in place of html templates or the like.

## SMD vs MD
All squares are rectangles, but not all rectangles are squares.
The same can be said of SMD - Markdown documents are valid SMD documents, but not necessarily the other way around.
With that out of the way, what's the difference?

A SMD document is made of layers.
Each layer has a name, and can contain markdown content and/or other layers.

```
layer welcome:
# Welcome to Structured-Markdown!
this is markdown embedded within a layer.
```

This is a block of markdown within a layer whose name is `welcome`.
Here is the equivalent html.

```html
<div class='root'>
<div class='welcome'>
<h1>Welcome to Structured-Markdown!</h1>
<p>this is markdown embedded within a layer.</p>
</div>
</div>
```

Essentially, a layer is a `div`, the layer name being the `div`'s class.
Everything is put into a `root div` before the parsed SMD is returned.

Nesting is pretty simple:

```
layer welcome:
# Welcome to Structured-Markdown!
this is markdown embedded within a layer.
layer nested:
hey, this is nested
more markdown after the nesting
```

Which becomes:

```html
<div class='root'>
<div class='welcome'>
<h1>Welcome to Structured-Markdown!</h1>
<p>this is markdown embedded within a layer.</p>
<div class='welcome'>
<p>hey, this is nested</p>
</div>
<p>more markdown after the nesting</p>
</div>
</div>
```

Where it really shines is when text is wrapped in complex formatting, like this navbar example:

```
layer navbar:
layer logotype:
# Templating Engine
layer navlinks:
1. [blog](/blog)
2. [about](/about)
3. [projects](/projects)
```

Note that the expanded html is longer and more verbose.

```html
<div class='root'>
<div class='navbar'>
<div class='logotype'>
<h1>Templating Engine</h1>
</div>
<div class='navlinks'>
<ol>
<li><a href="/blog">blog</a></li>
<li><a href="/about">about</a></li>
<li><a href="/projects">projects</a></li>
</ol>
</div>
</div>
</div>
```

That's about it for now.
Not all features are implemented as this is still a WIP.


Release files for structured-markdown 0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for structured-markdown 0.0
File Size Uploaded
structured_markdown-0.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for structured-markdown 0.0
File Interpreter ABI Platform
structured_markdown-0.0-py3-none-any.whl Python 3 none any Details

Total release size:8.7 kB

Release files / structured_markdown-0.0.tar.gz

Download URL structured_markdown-0.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
047928cc0386769374efc9624aabbf3411dfca573b882e98609e2e02a6cd4434
BLAKE2b-256 checksum
How to use checksums
267d686383feef86a682a603271f82875727c02bb8dabfefc4f452d5e8511703
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / structured_markdown-0.0-py3-none-any.whl

Download URL structured_markdown-0.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ac004715a6d6b0edcad412d73883bf9c5ab2ee5c40ad02e7419a82e899db062
BLAKE2b-256 checksum
How to use checksums
162ca8676d2b5f6438c569211dff03421722f080e4343cead0e912517a7382c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

This release

0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page