roniemartinez / latex2mathml

Pure Python library for LaTeX to MathML conversion
MIT License
183 stars 25 forks source link

Allow xml conversion only #431

Closed rob-blackbourn closed 10 months ago

rob-blackbourn commented 10 months ago

Great package!

I'd like write an extension for markdown using this package.

Extensions for the markdown package take an xml...Element. This package provides an Element as an intermediate step, before converting it to a string with the convert function.

This pull request splits out the element conversion stage to a function called convert_to_element, and changes convert to call convert_to_element. I have also added a parent argument, to allow simple insertion of the element into an xml tree if required.

I also added a py.typed file, to allow the types to be visible PEP 561, and put the .vscode folder in the .gitignore.

roniemartinez commented 10 months ago

Thanks a lot for your PR! 🙌

Could you also add tests?

py.typed

Does this not require update to the pyproject.toml?

rob-blackbourn commented 10 months ago

I've added a test to check for element generation, and generation as a child of a parent element.

You don't need to make any changes to the pyproject.toml for py.typed. I ran poetry build and inspected the tar file, and I can see py.typed exists. I use poetry in my projects and I see this behaviour.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (99c7e59) 100.00% compared to head (490425f) 100.00%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #431 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 7 7 Lines 938 943 +5 ========================================= + Hits 938 943 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

roniemartinez commented 10 months ago

Thanks @rob-blackbourn

roniemartinez commented 10 months ago

@all-contributors please add @rob-blackbourn for code

allcontributors[bot] commented 10 months ago

@roniemartinez

I've put up a pull request to add @rob-blackbourn! :tada: