Skip to main content

A markdown lexer and parser which gives the programmer atomic control over markdown parsing.

Project description

atomd

A markdown lexer and parser which gives the programmer atomic control over markdown parsing to html.

Atomd tokenizes first with the lexer, so parsers for other formats can be built faster and with less code.

Lexer

This functionality tokenizes the markdown based on the lexicon, which is a mapping of markdown syntax to tokens that will represent the specific syntax. Tokenization is done with a series of regular expressions.

Parsers

Currently, html.py is the only provided parser. The parser() function takes tokenized markdown and replaces tokens and returns the proper html.

Usage

A function in atomd.py called md2html() is provided to wrap both of these features together, allowing for easy use.

If you want to parse a markdown file, do the following:

from atomd import md2html

html = md2html(filename="path/to/myfile.md").decode('utf-8')

If you want to parse a string of markdown, do the following:

from atomd import md2html

html = md2html(md=b"# My markdown ByteString!").decode('utf-8')

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

atomd-0.1.0.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

atomd-0.1.0-py3-none-any.whl (19.8 kB view hashes)

Uploaded Python 3

Supported by

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