notion-to-md icon indicating copy to clipboard operation
notion-to-md copied to clipboard

Nested Lists and Maths Rendering

Open aldenluthfi opened this issue 6 months ago • 8 comments

Description

I write my proofs in callouts on one of my blogs about math. The parser seems to miss some parts.

Input

Image

Expected Output

> **PROOF**
> 
> Part 1: Proof that there are atleast *one* solution
> 
> 1. We have concluded that given $a$ and $b$, we can always find $m,n \in Z$ such that $\gcd(a,b) = am+bn$
> 2. Let $\gcd(a,b)=d$
> 3. $*d \mid c$* means $c = kd$ for some $k \in \Z$
> 4. We can rewrite $c=ax+by$ to $kd = ax+by$
> 5. We can always find $x,y \in \Z$ where $c=ax+by$ because from (1), we can always find $m, n \in Z$ such that $d = am+bn$ and
>     
>     $$
>     \begin{split}
>     c &= ax+by \\
>     kd &= k(am+bn)
>     \end{split}
>     
>     $$
>     
> 6. Therefore we can find atleast one pair of $x$ and $y$ such that $c = ax+by$ if $\gcd(a,b) \mid c$ in the form of $x=km$ and $y=kn$ where $k=\frac{c}{\gcd(a,b)}$ 
> 
> Part 2: Proof that there are *infinitely many* solutions
> 
> 7. From (6), suppose $x'$ and $y'$ is also a solution to $c = ax+by$
> 8. Therefore we can write $ax+by=ax'+by'$
> 9. From (8) we can rearrange to $a(x-x')=b(y'-y)$
> 10. Let $a'=\frac{a}{d}$ and $b'=\frac{b}{d}$, $a'$ and $b'$ are coprime because of the following proof of contradiction
>     1. Assume $a'=\frac{a}{d}$ and $b'=\frac{b}{d}$ are not coprime and $d = \gcd(a,b)$ 
>     2. there is $e> 1$ such that $e=\gcd(a',b')$
>     3. Therefore $\frac{a'}{e}=\frac{a}{ed}$ is an integer, same goes with $\frac{b'}{e}=\frac{b}{ed}$
>     4. $ed > d$ since $e > 1$
>     5. Because there is an integer larger than $d$ that divides $a$ and $b$, $d \neq \gcd(a,b)$
>     6. Therefore (a) is wrong, $a'$ and $b'$ are coprime $\square$
> 11. From (9) and (10), $a'(x-x')=b'(y'-y)$
> 12. From (11)
>     
>     $$
>     \begin{split}
>     y'-y& =\frac{a'(x-x')}{b'}\\
>     y' &=y + \frac{a'(x-x')}{b'}
>     \end{split}
>     $$
>     
> 13. From (11)
>     
>     $$
>     \begin{split}
>     x-x'& =\frac{b'(y'-y)}{a'}\\
>     x' &=x - \frac{b'(y'-y)}{a'}
>     \end{split}
>     $$
>     
> 14. from (11), $\frac{(x-x')}{b'} = \frac{(y'-y)}{a'}$
> 15. $x'$ is an integer if $\frac{(y'-y)}{a'}$ is an integer because $x,b'\in \Z$
> 16. $\frac{(y'-y)}{a'}$ is an integer if $x'$  is an integer because of the following proof
>     1. Assume $a' \mid (y'-y)$
>     2. Therefore $(y'-y) = a'r$ for some $r \in \Z$
>     3. From (b), $by'-by = a'r$
>     4. Because $by' = c - ax'$ and $by = c - ax$, thus $ax-ax'= a'r$
>     5. Dividing by $a$, $x-x'= \frac{r}{d}$
>     6. From (e) rearranging to $d(x-x')= r$, the statement is true if $x'$ is an integer because $d,x,r \in \Z$
>     7. Therefore $\frac{(y'-y)}{a'} \in \Z$ if $x'\in \Z$ $\square$
> 17. Let  $\frac{(x-x')}{b'} = \frac{(y'-y)}{a'} = t$
> 18. Rewrite $x'=x - \frac{tb}{d}$ and $y'= y + \frac{ta}{d}$
> 19. Therefore we can find infinitely many $x$ and $y$ such that $c = ax+by$ if $\gcd(a,b) \mid c$ in the form of $x=km - \frac{tb}{d}$ and $y=kn+ \frac{ta}{d}$ where $k=\frac{c}{\gcd(a,b)}$ for every integer $t \in \Z$ $\square$

Actual Output

> **PROOF**  
> Part 1: Proof that there are atleast _one_ solution  
>   
> 1. We have concluded that given $a$ and $b$, we can always find $m,n \in Z$ such that $\gcd(a,b) = am+bn$  
>   
> 2. Let $\gcd(a,b)=d$  
>   
> 3. $d \mid c$ means $c = kd$ for some $k \in \Z$  
>   
> 4. We can rewrite $c=ax+by$ to $kd = ax+by$  
>   
> 5. We can always find $x,y \in \Z$ where $c=ax+by$ because from (1), we can always find $m, n \in Z$ such that $d = am+bn$ and  
>   
> 6. Therefore we can find atleast one pair of $x$ and $y$ such that $c = ax+by$ if $\gcd(a,b) \mid c$ in the form of $x=km$ and $y=kn$ where $k=\frac{c}{\gcd(a,b)}$  
>   
> Part 2: Proof that there are _infinitely many_ solutions  
>   
> 1. From (6), suppose $x'$ and $y'$ is also a solution to $c = ax+by$  
>   
> 2. Therefore we can write $ax+by=ax'+by'$  
>   
> 3. From (8) we can rearrange to $a(x-x')=b(y'-y)$  
>   
> 4. Let $a'=\frac{a}{d}$ and $b'=\frac{b}{d}$, $a'$ and $b'$ are coprime because of the following proof of contradiction  
>   
> 5. From (9) and (10), $a'(x-x')=b'(y'-y)$  
>   
> 6. From (11)  
>   
> 7. From (11)  
>   
> 8. from (11), $\frac{(x-x')}{b'} = \frac{(y'-y)}{a'}$  
>   
> 9. $x'$ is an integer if $\frac{(y'-y)}{a'}$ is an integer because $x,b'\in \Z$  
>   
> 10. $\frac{(y'-y)}{a'}$ is an integer if $x' $ is an integer because of the following proof  
>   
> 11. Let $ \frac{(x-x')}{b'} = \frac{(y'-y)}{a'} = t$  
>   
> 12. Rewrite $x'=x - \frac{tb}{d}$ and $y'= y + \frac{ta}{d}$  
>   
> 13. Therefore we can find infinitely many $x$ and $y$ such that $c = ax+by$ if $\gcd(a,b) \mid c$ in the form of $x=km - \frac{tb}{d}$ and $y=kn+ \frac{ta}{d}$ where $k=\frac{c}{\gcd(a,b)}$ for every integer $t \in \Z$ $\square$

No pressure though, even the native notion export to md doesn't get it right

aldenluthfi avatar May 17 '25 16:05 aldenluthfi

I have a similar problem, this is basically what i am calling

const blocks = await n2m.pageToMarkdown(pageId);
const markdown = n2m.toMarkdownString(blocks);

this is the notion page

Image

this the output

> ## 📖 US-1 Create Capacity Plan  
>   
> As a warehouse manager, I need the ability to create Capacity Plan so that it could be used to generate slots for appointment scheduling.   
>   
> ### Acceptance Criteria  
>   
> 1. As a warehouse manager, when I submit a request to create a capacity plan, the system should perform the following:  
>   
>   
>   
> ## US-2 Update Capacity Plan  
>   
> As a warehouse manager, I need the ability to update an existing Capacity Plan to accommodate changes in scheduling requirements.  
>   
> ### Acceptance Criteria  
>   
> 1. As a warehouse manager, when I submit a request to update a capacity plan, the system should perform the following:  

the toMarkdownString is ignoring all children of a callout block and using directly it's 'parent' text however the 'parent' text does not contain all deeper nested child items

Image

for me the (native) export directly from notion works

creichelt-transporeon avatar Jun 12 '25 14:06 creichelt-transporeon

Hey there @aldenluthfi @creichelt-transporeon, v3 has a bunch of issues, and it doesn't handle the inconsistent representation of blocks from the API.

I would appreciate it if you could try v4 and let me know if it works as expected. If not, we would put this on priority in the upcoming release v4-alpha.6

souvikinator avatar Jun 26 '25 14:06 souvikinator

Hey there @aldenluthfi @creichelt-transporeon, v3 has a bunch of issues, and it doesn't handle the inconsistent representation of blocks from the API.

I would appreciate it if you could try v4 and let me know if it works as expected. If not, we would put this on priority in the upcoming release v4-alpha.6

Sadly, no. the nested items are still gone :(

aldenluthfi avatar Jun 27 '25 13:06 aldenluthfi

Got you @aldenluthfi , thanks for getting back. Can you share a copy of the notion page so we can dig down on the issue?

We'll ship the fixes in upcoming release

souvikinator avatar Jun 27 '25 13:06 souvikinator

Sure, it is live on https://aldenluthfi.notion.site/Secret-Things-and-How-to-Count-Them-5080c01875f44596b1aed9b97ec2cb3b?pvs=143

aldenluthfi avatar Jun 29 '25 03:06 aldenluthfi

i have submitted a pr #155 for this issue. kindly review and merge

yashvikram30 avatar Jul 11 '25 13:07 yashvikram30

@yashvikram30 reviewed the PR it has a bunch of issues, and the PR doesn't cover all the rendering issues.
Let's schedule a call to review this around tomorrow night?

souvikinator avatar Jul 19 '25 20:07 souvikinator

@aldenluthfi, the latest version fixes a bunch of issues. Will be making a new release with the remaining fixes. Few of the inline equations were not rendering.

Next will be the nested items and callout related issues.

souvikinator avatar Jul 21 '25 03:07 souvikinator