mdtex2html


Namemdtex2html JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/polarwinkel/mdtex2html
Summarylibrary to convert Markdown with included LaTeX-Formulas to HTML with MathML
upload_time2024-01-26 18:18:10
maintainer
docs_urlNone
authorDirk Winkel
requires_python>=3.7, <4
license
keywords tex latex markdown html markdown2html latex2mathml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mdtex2html
python3-library to convert Markdown with included LaTeX-Formulas to HTML with MathML

## What is mdtex2html

`mdtex2html` is a library to convert (Github-flavored) Markdown-Code with included LaTex-formulas to HTML-Source. The formulas are converted to MathML.

An inline-formula can either start and end with `$` or it can start with `\(` and end with `\)`, according to valid LaTeX-Code. Block-formulas either start and end with `$$` or start with `\[` and end with `\]`.

An example that `mdtex2html` will convert:

```
# Example-Title

TeX-Formula: $\sqrt2=x^2 \Rightarrow x=\sqrt{\sqrt{2}}$

- This
- is
    - a List with `inline-Code`
```

## How to use mdtex2html

install it, i.e. using pip:

`python3 -m pip install mdtex2html`

then in python import in your code with

`import mdtex2html`

and convert your mdTeX with something like

`mdtex2html.convert('- Hello ${\sqrt{World}}^2$!')`

passing any mdTeX-Code to `mdtex2html.convert()`.

### Extra

You may want to (but don't need to) include this css-snippet on your page to hide error message texts, only showing on mouse-over:

```
.tooltip .tooltiptext {
    display: none;
}
.tooltip:hover .tooltiptext {
    display: inline;
    border-radius: 0.3em;
    background-color: #777;
    position: fixed;
}
```

### Markdown-Extensions

Starting with v1.1 you can use python-markdown-extensions for i.e. tables, definition-lists, html-attributes and much more by passing a list of the extension(s) to be used to the `convert`-command as described in the [python-markdown documentation](https://python-markdown.github.io/extensions/).

For example `mdtex2html.convert('Hello green\n{: style="color:green" }', extensions=['attr_list'])` will make use of the extension `attr_list`.

## Dependencies

This depends on:

- [latex2html](https://github.com/roniemartinez/latex2mathml)
- [Python-Markdown](https://github.com/Python-Markdown/markdown)

The dependencies will be installed when installing using pip.

## Limitations

The Firefox browser will display the result smoothly, as well as Safari (according to user reports).

~~Just be aware that the Chromium-engine (Browsers: Chrome, Edge, ...) still is not able to render MathML properly, but rumors say that in 2020 work has started again to make that happen, so maybe you want to check the status there.~~
In 2023 MathML Core got finally supported by the Blink-Engine of Chrome (and therefore Edge etc.). So this works now in all mainstream-browsers.

## Credits

Special thanks to [Ronie Martinez](https://github.com/roniemartinez) for creating [latex2html](https://github.com/roniemartinez/latex2mathml)!

This library is just a few lines of code added to his work and to [Python-Markdown](https://github.com/Python-Markdown/markdown).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/polarwinkel/mdtex2html",
    "name": "mdtex2html",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7, <4",
    "maintainer_email": "",
    "keywords": "TeX,LaTeX,Markdown,HTML markdown2html,latex2mathml",
    "author": "Dirk Winkel",
    "author_email": "it@polarwinkel.de",
    "download_url": "https://files.pythonhosted.org/packages/8a/2a/1423b31212a69d6bb93e9058ec71db313257b8d2ae069b530efe90f296e0/mdtex2html-1.3.0.tar.gz",
    "platform": null,
    "description": "# mdtex2html\npython3-library to convert Markdown with included LaTeX-Formulas to HTML with MathML\n\n## What is mdtex2html\n\n`mdtex2html` is a library to convert (Github-flavored) Markdown-Code with included LaTex-formulas to HTML-Source. The formulas are converted to MathML.\n\nAn inline-formula can either start and end with `$` or it can start with `\\(` and end with `\\)`, according to valid LaTeX-Code. Block-formulas either start and end with `$$` or start with `\\[` and end with `\\]`.\n\nAn example that `mdtex2html` will convert:\n\n```\n# Example-Title\n\nTeX-Formula: $\\sqrt2=x^2 \\Rightarrow x=\\sqrt{\\sqrt{2}}$\n\n- This\n- is\n    - a List with `inline-Code`\n```\n\n## How to use mdtex2html\n\ninstall it, i.e. using pip:\n\n`python3 -m pip install mdtex2html`\n\nthen in python import in your code with\n\n`import mdtex2html`\n\nand convert your mdTeX with something like\n\n`mdtex2html.convert('- Hello ${\\sqrt{World}}^2$!')`\n\npassing any mdTeX-Code to `mdtex2html.convert()`.\n\n### Extra\n\nYou may want to (but don't need to) include this css-snippet on your page to hide error message texts, only showing on mouse-over:\n\n```\n.tooltip .tooltiptext {\n    display: none;\n}\n.tooltip:hover .tooltiptext {\n    display: inline;\n    border-radius: 0.3em;\n    background-color: #777;\n    position: fixed;\n}\n```\n\n### Markdown-Extensions\n\nStarting with v1.1 you can use python-markdown-extensions for i.e. tables, definition-lists, html-attributes and much more by passing a list of the extension(s) to be used to the `convert`-command as described in the [python-markdown documentation](https://python-markdown.github.io/extensions/).\n\nFor example `mdtex2html.convert('Hello green\\n{: style=\"color:green\" }', extensions=['attr_list'])` will make use of the extension `attr_list`.\n\n## Dependencies\n\nThis depends on:\n\n- [latex2html](https://github.com/roniemartinez/latex2mathml)\n- [Python-Markdown](https://github.com/Python-Markdown/markdown)\n\nThe dependencies will be installed when installing using pip.\n\n## Limitations\n\nThe Firefox browser will display the result smoothly, as well as Safari (according to user reports).\n\n~~Just be aware that the Chromium-engine (Browsers: Chrome, Edge, ...) still is not able to render MathML properly, but rumors say that in 2020 work has started again to make that happen, so maybe you want to check the status there.~~\nIn 2023 MathML Core got finally supported by the Blink-Engine of Chrome (and therefore Edge etc.). So this works now in all mainstream-browsers.\n\n## Credits\n\nSpecial thanks to [Ronie Martinez](https://github.com/roniemartinez) for creating [latex2html](https://github.com/roniemartinez/latex2mathml)!\n\nThis library is just a few lines of code added to his work and to [Python-Markdown](https://github.com/Python-Markdown/markdown).\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "library to convert Markdown with included LaTeX-Formulas to HTML with MathML",
    "version": "1.3.0",
    "project_urls": {
        "Bug Reports": "https://github.com/polarwinkel/mdtex2html/issues",
        "Homepage": "https://github.com/polarwinkel/mdtex2html",
        "Source": "https://github.com/polarwinkel/mdtex2html"
    },
    "split_keywords": [
        "tex",
        "latex",
        "markdown",
        "html markdown2html",
        "latex2mathml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffe8c5fab9aa5d9254ad7c7e37d33a3c32fd49d82b4c6b54da337bbca378eb5c",
                "md5": "a644a088bb640ddc808bcc84423be054",
                "sha256": "3a8866bea9b30e2b4a0f447e3adf2f2e61844a5bc6335b1c6152c13f536e0fb0"
            },
            "downloads": -1,
            "filename": "mdtex2html-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a644a088bb640ddc808bcc84423be054",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7, <4",
            "size": 13926,
            "upload_time": "2024-01-26T18:18:07",
            "upload_time_iso_8601": "2024-01-26T18:18:07.219036Z",
            "url": "https://files.pythonhosted.org/packages/ff/e8/c5fab9aa5d9254ad7c7e37d33a3c32fd49d82b4c6b54da337bbca378eb5c/mdtex2html-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a2a1423b31212a69d6bb93e9058ec71db313257b8d2ae069b530efe90f296e0",
                "md5": "165de0f3741448ab0551287be1c09321",
                "sha256": "4c0dcbbf55d3edda9981f2b882ff2c6ab9d7ac054e451a346f6e48482e58b782"
            },
            "downloads": -1,
            "filename": "mdtex2html-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "165de0f3741448ab0551287be1c09321",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7, <4",
            "size": 14602,
            "upload_time": "2024-01-26T18:18:10",
            "upload_time_iso_8601": "2024-01-26T18:18:10.672277Z",
            "url": "https://files.pythonhosted.org/packages/8a/2a/1423b31212a69d6bb93e9058ec71db313257b8d2ae069b530efe90f296e0/mdtex2html-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-26 18:18:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "polarwinkel",
    "github_project": "mdtex2html",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mdtex2html"
}
        
Elapsed time: 0.17746s