Cobertos / md2notion

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

doesn't support block equation #56

Open AlieZVzz opened 1 year ago

AlieZVzz commented 1 year ago

The latex equation in mardown file is $$, which should be a block equation in notion. image But when I import this to notion, it is a Inline Equation. image Here is my code. It seems the code will tranform the single $ into double $$

from notion.client import NotionClient
from notion.block import PageBlock
import itertools
from md2notion.upload import upload, convert, uploadBlock
from md2notion.NotionPyRenderer import NotionPyRenderer, addLatexExtension
from tqdm.notebook import tqdm
import os

os.environ["http_proxy"] = "http://127.0.0.1:7890"
os.environ["https_proxy"] = "http://127.0.0.1:7890"
# Follow the instructions at https://github.com/jamalex/notion-py#quickstart to setup Notion.py
client = NotionClient(
    token_v2="")
page = client.get_block(
    "")
with open("text.md", "r", encoding="utf-8") as mdFile:
    newPage = page.children.add_new(PageBlock, title="XGBoost")
    lines = mdFile.readlines()

    rendered = convert(lines, addLatexExtension(NotionPyRenderer))
for blockDescriptor in tqdm(rendered):

    uploadBlock(blockDescriptor, newPage, mdFile.name)
williamium3000 commented 1 year ago

same problem here. Is there a solution for this?

AlieZVzz commented 1 year ago

I'm afraid not. I convert it manually so maybe you should try another way:(