Skip to main content

A simple library that translates LaTeX to Markdown.

Project description

texmd

A small library that converts LaTeX to Markdown. This package uses pylatexenc to parse the LaTeX expressions.

Installation

Run pip install texmd in the terminal.

Usage

This package allows you to load a .tex file directly.

from texmd import texmd # Import the package

file_path = "<PATH_TO_TEX_FILE>"
tex_file = texmd.load_file(file_path)

The loaded file tex_file is type of texmd.texmd.TexDocument.

If you want to parse the LaTeX string directly you can also do

tex_expr = "<TEX_EXPR>"
tex_file = texmd.parse(tex_expr)

We can convert then it to Markdown by

document = tex_file.to_md()

The output document is type of texmd.md.MdDocument. To output the document as Markdown syntax we can do

md = document.to_str()

and you can write it to a .md file.

Customization

If you don't like the way the package write the Markdown, or you want to support custom LaTeX expressions, you can use the API texmd.texmd.add_converter with a specific type from the package pylatexenc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

texmd-0.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file texmd-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: texmd-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for texmd-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 666d3b906eea3321674d72e8212e900332078f085422723d470504b7ef7586c5
MD5 83040988767c572025750146d9a5c019
BLAKE2b-256 52290c1b59a50cd097050a5e56d2a8f738ba998ae3043f59b6fe12a8f3e9cc0a

See more details on using hashes here.

Supported by

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