Skip to main content

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

Project description

atomd

Version 0.2.5

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

Atomd first tokenizes the markdown with the lexer.

Using the tokenized markdown, parsers for various different markup languages (HTML, XML, etc) are easier to implement, since it more or less becomes a game of find and replace.

Install

python3 -m pip install atomd

Usage

Functions in atomd.py called md2<target_language>() combine the lexer and parser to provide an easier calling convention.

In the case of the HTML parser, this is md2html().

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')

Lexer

This portion of the program tokenizes the markdown based on the lexicon, which is a mapping of markdown syntax items to tokens that will represent the specific syntax.

Tokenization is done with a series of regular expressions.

If there are bugs in the program, it is likely they exist in the regular expressions and can be fixed without significant design changes to the program, which allows for quick turnaround on bugfixes.

Parsers

Currently, atomd supports the following:

  • HTML (html.py)

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.2.5.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

atomd-0.2.5-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file atomd-0.2.5.tar.gz.

File metadata

  • Download URL: atomd-0.2.5.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5

File hashes

Hashes for atomd-0.2.5.tar.gz
Algorithm Hash digest
SHA256 8ddbd1f6a9426ab85c263c2a958ba497b04f0fe96cad87231ae5cf31ea9a60c3
MD5 68e8bd09f7a82bb0b74a0b1c3500a250
BLAKE2b-256 fad6be6d519f6ba9491369fa7418e7200ffaae915836e0b129e454c6d5491702

See more details on using hashes here.

File details

Details for the file atomd-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: atomd-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5

File hashes

Hashes for atomd-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bf5e339b953cebb237369e96efa8861479306e8849b70cec10d88be0dbd596d3
MD5 95d832116b462cdb5d6837e249325acb
BLAKE2b-256 15575f7589dba8fdfe2b5fb48763961c71b6986d7d29d52dc76ba987341f5920

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