Cobertos / md2notion

A better Notion.so Markdown importer
MIT License
654 stars 65 forks source link

Added conversion support for markdown equations to notion format. #26

Closed egordm closed 3 years ago

egordm commented 3 years ago

This PR adds an additional renderer (LatexNotionPyRenderer) which converts

While Inline Equation uses notion accepted format ($$) it is not yet translated to an actual inline-block. There is a PR pending in notion-py for this (https://github.com/jamalex/notion-py/pull/247).

A relevant issue for this is #20

Example usage:

from md2notion.NotionPyRenderer import LatexNotionPyRenderer
from md2notion.upload import convert

mdFile1 = io.StringIO('$y = ax + b$\n$$\ny = ax + b \n $$')
mdFile1.__dict__["name"] = path
Cobertos commented 3 years ago

Hey, thanks for the implementation of this!

Just a couple things:

egordm commented 3 years ago

Hey @Cobertos,

Thanks for the feedback. I have changed the code to use an extension instead and added a few tests.

Cobertos commented 3 years ago

This looks great!

Any reason you can think of to not have latex extension be on by default? I'd like to keep feature parity where possible with Notion's uploader and #20 seems to suggest that it is default in Notion's uploader

I'll pull this down and give it a test by the end of the week

Cobertos commented 3 years ago

Looks like the upstream PR is merged. Testing it out rn