Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The issue with the Heading wrapped inside a link #46

Open
victory-sokolov opened this issue Feb 3, 2023 · 4 comments
Open

[Bug] The issue with the Heading wrapped inside a link #46

victory-sokolov opened this issue Feb 3, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@victory-sokolov
Copy link

Hey! First of all would like to thank you for such a great library!

Noticed a few issues when generating Markdown.

I have the following HTML:

<a href="/post/some-post">
  <h2>Subheading</h2>
 </a>

It produces the following Markdown

[Subheading](/post/some-post)

Expected output would be:

## [Subheading](/post/some-post)

Another issue I've encountered is that multiline code is not wrapped to the backticks, but i guess i can open another issue for this.

@victory-sokolov victory-sokolov changed the title Issue with Heading wrapped in link The issue with the Heading wrapped inside a link Feb 3, 2023
@nonara nonara changed the title The issue with the Heading wrapped inside a link [Bug] The issue with the Heading wrapped inside a link Feb 8, 2023
@nonara nonara added the bug Something isn't working label Feb 8, 2023
@nonara
Copy link
Collaborator

nonara commented Feb 8, 2023

Hi Viktor. Thank you for the report & kind words.

You're right that this isn't ideal. I will give some thought on how to approach this.

Can you give some more detail on the multiline code issue (an example, preferably). Code fencing should be working properly.

@victory-sokolov
Copy link
Author

victory-sokolov commented Feb 11, 2023

Yes, sure here is an example of the HTML and when converting to markdown it converts to plain text without wrapping code into backticks

Sorry for the extended example, but that's how the code example looks from the NextJS site.
I didn't try yet, but maybe the code snippet should be wrapped into the <code> blocks

<pre class="prism-code language-typescript" style="color: rgb(248, 248, 242); background-color: rgb(40, 42, 54);"><div class="sc-36549842-4 bmkFVs"></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">1</span><span class="sc-36549842-2 fODbQc"><span class="token keyword" style="color: rgb(189, 147, 249); font-style: italic;">class</span><span class="token plain"> </span><span class="token class-name">Invoice</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span></span></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">2</span><span class="sc-36549842-2 fODbQc"><span class="token plain">    </span><span class="token function" style="color: rgb(80, 250, 123);">constructor</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token keyword" style="color: rgb(189, 147, 249); font-style: italic;">public</span><span class="token plain"> persistanceStorage</span><span class="token operator">:</span><span class="token plain"> PersistanceStorage</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token plain"></span></span></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">3</span><span class="sc-36549842-2 fODbQc"><span class="token plain" style="display: inline-block;">
</span></span></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">4</span><span class="sc-36549842-2 fODbQc"><span class="token plain">    </span><span class="token keyword" style="color: rgb(189, 147, 249); font-style: italic;">public</span><span class="token plain"> </span><span class="token keyword" style="color: rgb(189, 147, 249); font-style: italic;">async</span><span class="token plain"> </span><span class="token function" style="color: rgb(80, 250, 123);">persistInvoice</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">data</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token plain"> </span><span class="token punctuation" style="color: rgb(248, 248, 242);">{</span><span class="token plain"></span></span></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">5</span><span class="sc-36549842-2 fODbQc"><span class="token plain">  </span><span class="token keyword" style="color: rgb(189, 147, 249); font-style: italic;">this</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token plain">persistanceStorage</span><span class="token punctuation" style="color: rgb(248, 248, 242);">.</span><span class="token function" style="color: rgb(80, 250, 123);">saveData</span><span class="token punctuation" style="color: rgb(248, 248, 242);">(</span><span class="token plain">data</span><span class="token punctuation" style="color: rgb(248, 248, 242);">)</span><span class="token punctuation" style="color: rgb(248, 248, 242);">;</span><span class="token plain"></span></span></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">6</span><span class="sc-36549842-2 fODbQc"><span class="token plain">    </span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span><span class="token plain"></span></span></div><div class="sc-36549842-0 kfTyDW token-line" style="color: rgb(248, 248, 242);"><span class="sc-36549842-1 eePLWY">7</span><span class="sc-36549842-2 fODbQc"><span class="token plain"></span><span class="token punctuation" style="color: rgb(248, 248, 242);">}</span></span></div></pre>

@nonara
Copy link
Collaborator

nonara commented Feb 11, 2023

Ah, ok. Thanks for the example! Yes, we do handle pre by itself differently than pre with code, to best handle all situations.

Try wrapping with code (inside pre), and it should work the way you'd like!

@victory-sokolov
Copy link
Author

Thank you, wrapping inside the code, worked well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants