JohannesKaufmann/html-to-markdown

🐛 Bug Consecutive <span> missing spaces

ilovesusu opened this issue ¡ 3 comments

Describe the bug
Consecutive <span> missing spaces
like

import"fmt"
fortrue

missing spaces!!!!

HTML Input

<div class="example_code">
<span style="color: #b1b100; font-weight: bold;">package</span> main<br>
<br>
<span style="color: #b1b100; font-weight: bold;">import</span> <span style="color: #cc66cc;">"fmt"</span><br>
<br>
<span style="color: #993333;">func</span> main<span style="color: #339933;">()</span> <span style="color: #339933;">{</span><br>
&nbsp; &nbsp; <span style="color: #b1b100; font-weight: bold;">for</span> <span style="color: #000000; font-weight: bold;">true</span> &nbsp;<span style="color: #339933;">{</span><br>
&nbsp; &nbsp; &nbsp; &nbsp; fmt<span style="color: #339933;">.</span>Printf<span style="color: #339933;">(</span><span style="color: #cc66cc;">"xxxxx。<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">);</span><br>
&nbsp; &nbsp; <span style="color: #339933;">}</span><br>
<span style="color: #339933;">}</span><br>
</div>

Generated Markdown

package main



import"fmt"



func main(){

fortrue{


        fmt.Printf("xxxxx。\n");

}

}

Expected Markdown

package main

import "fmt"

func main(){

        for true{
        
                fmt.Printf("xxxxx。\n");
        
        }
}

Thanks for reporting this bug! Unfortunately thats a difficult one to fix...

Thanks again for reporting this bug!

Turns out the V2 of this library (that I am currently working on) also had this problem. But after another major rewrite of V2 it finally works:

package main

import "fmt"

func main() {
    for true  {
        fmt.Printf("xxxxx。\\n");
    }
}

Thanks for letting me know! That was really helpful taking that into consideration!

The V2 is not ready to be published though. That is going to take more time...
So I am keeping this issue open until then.