Skip to main content

Convert wikitext to HTML

Project description

wikitexthtml

GitHub License GitHub Tag GitHub commits since latest release

GitHub Workflow Status (Testing) GitHub Workflow Status (Release)

wikitexthtml is a library that renders HTML from WikiText.

Dependencies

  • Python3.8 or higher.
  • python-slugify (via setup.py), for slugs in anchors
  • ply (via setup.py), to implement {{#ifexpr}} and {{#expr}}
  • wikitextparser (via setup.py), to make sense of wikitext

Installation

pip install wikitexthtml

Or for development work:

python3 -m venv .env
.env/bin/pip install -e .

Usage

Extend Page by implementing the missing functions as seen in prototype.py. This way you can customize where files are read from (from disk, from a database, etc) and how to sanitize titles and URLs. In the tests folder examples of this can be found.

Now you can instantiate this new class and call render() on it. The result will be available in html. For example:

class WikiPage(Page):
    ...

print(WikiPage("Main Page").render().html)

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

wikitexthtml-1.2.0.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

wikitexthtml-1.2.0-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file wikitexthtml-1.2.0.tar.gz.

File metadata

  • Download URL: wikitexthtml-1.2.0.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for wikitexthtml-1.2.0.tar.gz
Algorithm Hash digest
SHA256 45922fcf61642dfb66a62f5f86ce536425be6841cabc6261e7870cf3ffd5e854
MD5 c7ad1d4a4b77f57e8a89f1ae16ef23ec
BLAKE2b-256 c0da2936fc340c89c762550636e78beaed1845acfd636286e5bcce84df509075

See more details on using hashes here.

File details

Details for the file wikitexthtml-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wikitexthtml-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b856659ff0d7d2cf8e336edf9af5a9803f92231bafe6ed4d5fa77a763a21a4a
MD5 c0a8b45305570677358ed92d5ec2d782
BLAKE2b-256 e8ab100007c50c40271fadb61ef3043cb47f4d91c4b662d1ccb69ee1c84622ea

See more details on using hashes here.

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