Skip to main content

Add an extra dimension to your markdown documents

Project description

# 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.


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

structured_markdown-0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

structured_markdown-0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file structured_markdown-0.0.tar.gz.

File metadata

  • Download URL: structured_markdown-0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for structured_markdown-0.0.tar.gz
Algorithm Hash digest
SHA256 047928cc0386769374efc9624aabbf3411dfca573b882e98609e2e02a6cd4434
MD5 94a28a997f4d0acc1e9cbcb416ad3a50
BLAKE2b-256 267d686383feef86a682a603271f82875727c02bb8dabfefc4f452d5e8511703

See more details on using hashes here.

File details

Details for the file structured_markdown-0.0-py3-none-any.whl.

File metadata

  • Download URL: structured_markdown-0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for structured_markdown-0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ac004715a6d6b0edcad412d73883bf9c5ab2ee5c40ad02e7419a82e899db062
MD5 a11d1a9f7db5016888d6356e08ae6834
BLAKE2b-256 162ca8676d2b5f6438c569211dff03421722f080e4343cead0e912517a7382c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page