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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
666d3b906eea3321674d72e8212e900332078f085422723d470504b7ef7586c5
|
|
| MD5 |
83040988767c572025750146d9a5c019
|
|
| BLAKE2b-256 |
52290c1b59a50cd097050a5e56d2a8f738ba998ae3043f59b6fe12a8f3e9cc0a
|