Skip to main content

submark

Subset of Markdown

This project started as an example project to describe migrating from a script to a package, utilizing flit, tox, coverage, and pytest.

See http://testandcode.com/80 for the story.

Features

  • Convert headings

    • # heading -> <h1> heading </h1>
    • ## heading -> <h2> heading </h2>
    • ### heading -> <h3> heading </h3>
    • #### heading -> <h4> heading </h4>
    • ##### heading -> <h5> heading </h5>
  • Convert strong

    • **strong** -> <strong>strong</strong>
    • __strong__-> <strong>strong</strong>
  • Convert em

    • **something** -> <em>something</em>
    • __something__-> <em>something</em>
  • links

    • [message](http://some.link.html "my title")
      -> <a href="http://some.link.html" title="my title">message</a>
    • [message](http://some.link.html)
      -> <a href="http://some.link.html">message</a>
  • images

    • ![alt](/some/image.png "title")'
      -> '<img src="/some/image.png" title="title"/>
  • inline code

    • this is `some code`
      -> this is <code>some code</code>
  • line breaks with two spaces at end of text

  • horizontal rules, 3 or more dashes

    • --- -> <hr>

Usage

Use it like this:

$ submark something.md > something.html

or:

$ cat something.md | submark > something.html

or:

$ echo '**hi**' | submark
<strong>hi</strong>

Dev & Test virtual environment

Testing and development should be done with a virtual environment.

$ git clone https://github.com/okken/submark.git
$ cd submark
$ python3 -m venv venv --prompt submark
$ source venv/bin/activate
(submark) $ pip install -U pip

Testing

Testing is done with tox.

(submark) $ pip install tox
(submark) $ tox

Development

Development requires a few tools. Install submark locally and install dev tools with flit.

(submark) $ pip install flit
(submark) $ flit install --pth-file

Then you can test any changes locally with pytest.

(submark) $ pytest --cov=submark 

And when ready to test everything as an installed package:

(submark) $ tox

Building a wheel

Make sure everything is committed before running flit.

(submark) $ pip install flit
(submark) $ flit build

Yep. That's it. There should be a wheel now sitting in a dist folder.

(submark) $ ls dist
submark-0.5-py2.py3-none-any.whl
submark-0.5.tar.gz

Deploying

Flit does that too.

(submark) $ flit publish

But don't do that unless:

  • You are Brian Okken

or:

History

  • 0.1 Initial script and tests
  • 0.2 build wheel with flit
  • 0.3 build and test with tox
  • 0.4 move source module into a package directory
  • 0.5 move tests into tests directory
  • 0.6 hook up readme in toml file
  • 0.7
    • flit for development with requires-extra,
    • support for links, images, inline code, line breaks, horizontal rules

Metadata

Release files for submark 0.7

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

Source distribution (sdist)

Source distribution for submark 0.7
File Size Uploaded
submark-0.7.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for submark 0.7
File Interpreter ABI Platform
submark-0.7-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.5 kB

Release files / submark-0.7.tar.gz

Download URL submark-0.7.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c7d5bfae94ed81231330c738a46cdaef47843a032ac07fb0850389b7f42ba6ae
BLAKE2b-256 checksum
How to use checksums
672dc7e85df74e7e24ef40ad84e344599ad8d68761b38a0b58787ba092670f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release files / submark-0.7-py2.py3-none-any.whl

Download URL submark-0.7-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
99907020cdf75d12c45f64629a5aab579bedbe3c2b4f025201cb6bee88117c96
BLAKE2b-256 checksum
How to use checksums
f13d5420909c7c4522235230921b673f970daefa64339f314b39c2d6cb85b149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release history Release notifications | RSS feed

This release

0.7 This release

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.2

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