Coder Social home page Coder Social logo

submark's Introduction

submark

image codecov Build Status

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

submark's People

Contributors

okken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

submark's Issues

Add __main__.py

Hi Brian! I loved this episode. I noticed that you mentioned using cli.py and I thought I'd drop by to recommend using __main__.py so python -m submark works. I don't have time right now to submit a PR, but if that sounds too you like a good change, I totally can later.

Thanks again for the awesome podcast!

tox python 3.7

I don't know how this should be handled, but there seems to be an implicit requirement for python 3.7 (during setup of the project):

(submark) aj@aj-XPS-L412Z:~/github/submark$ pip install tox
...
ERROR:  py37: InterpreterNotFound: python3.7

Thank's for all great stuff that you do for the community!
/AJ

multi-level lists

like:

  • this is top level
  • and this
    • this a sub list
  • but also numbers
    1. this could be a numbered
    2. sublist

and:

  1. top could be numbers
  2. like this
    • with a sub list
    • with bullets

Readme suggestion..

If the Testing and Development sections get flipped around so Dev is first then it is not longer an issue that tox needs flit installed before it gets run... as I discovered while following things in order!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.