showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.26k stars 1.56k forks source link

Blockquote doesn't render #938

Closed paviad closed 2 years ago

paviad commented 2 years ago

Blockquotes are not rendered, the > sign is visible and no solid grey line appears.

It is also broken in the demo:

http://demo.showdownjs.com/#!#blockquotes:~:text=for%20more%20info-,Blockquotes,-You%20can%20indicate

image

MarketingPip commented 2 years ago

It appears this has been addressed. @paviad - here is an example of it working properly!

Blockquotes Working Demo

It appears you can close this issue!

paviad commented 2 years ago

I am too silly.... I am showing the raw markdown in the picture... It actually worked in the demo all along. Sorry for the trouble.

MarketingPip commented 2 years ago

@paviad - I am not a maintainer of this project!

Just throwing my two cents in to try and speed up / close some issues.

Tho valid point - it does appear the version is not updated / matching the same as the demo.

I personally would leave this open till they see this.

EDIT: Just seeing your updated comment. If there is an option I am missing to turn on the block quotes. Please let me know. As it only appears to work in demo for me.

paviad commented 2 years ago

It works perfectly, and has worked for a long time... I misinterpreted what I was seeing in the demo. And also in my own code I had a bug :)

MarketingPip commented 2 years ago

Correct me if I am wrong. I can not seem to get this working

> hello

should become

<blockquote>
  <p>hello</p>
</blockquote>

correct?

Or is there a option that needs to be turned on for this? Would like an update / some help with this on my end - just looking at it now trying to help you! haha! (doesn't work in my version of showdown but works in demo)

And if the case is we both need more :coffee: today - I would advise closing issue and if we are not losing our marbles. Leave it open! :+1:

ps; not that we know each other etc but regardless - hope you're having a great weekend!

paviad commented 2 years ago

There is no option to be enabled, it works out of the box, and, yes, you are right, and I have closed this issue!

Thanks and you have a great weekend too! :)

MarketingPip commented 2 years ago

@paviad ah - I don't know how or why but I had an older version included that did not have the support needed for.

Thanks for keeping me updated regardless tho & cheers :beers:

MarketingPip commented 2 years ago

@paviad assuming we both ran into the same issue and we were trying to take HTML to MD?

That said, if that was the case.

This means our block quotes were encoded with HTML entity.

Which I do believe - Showdown should provide a fix etc if the line starts with HTML entity for > that it is replaced with a non HTML entity.

So I would see this somewhat as a bug / feature request.

🙏

paviad commented 2 years ago

Let me describe the bug that stopped me, the markdown text that I was trying to process using this library was in an html-encoded format so instead of the blockquote character > there was &gt; in the source text, that's why my markdown did not show it properly.

Once I decoded the input the markdown did process correctly, and blockquotes are rendered as <blockquote> tags. Then it's just css to style them (with a vertical line on the left for example).

EDIT: I don't believe this library should do the decoding, I used the he library for that

MarketingPip commented 2 years ago

Let me describe the bug that stopped me, the markdown text that I was trying to process using this library was in an html-encoded format so instead of the blockquote character > there was &gt; in the source text, that's why my markdown did not show it properly.

Once I decoded the input the markdown did process correctly, and blockquotes are rendered as <blockquote> tags. Then it's just css to style them (with a vertical line on the left for example).

Correct - so you faced the same problem as me. A > being replaced with the HTML entity of &gt;

As &gt; and &lt; is a character entity reference for the > and < character in HTML

I understand 100% that decoding should not happen in the script. And the user / developer should do this themselves. Tho this is a problem / bug. As if it starts on a new line with no characters behind it. It should be rendered as a block quote. Without you having to replace all matches of &gt; to > as that acts more of a risk...

Hence why I say this is a bug now?

paviad commented 2 years ago

Not sure I understand why you think it is a bug in this library. The source markdown includes >, which for some reason (which is dependent on your particular implementation) it is encoded to &gt; you either have to stop that from happening, or decode it back before sending it to this library for processing.

MarketingPip commented 2 years ago

Again because block quote's require a >

Showdown automatically converts it into a > if you check.. (when using innerHTML content) and not text...

Hence instead of causing risks by allowing > to not become a HTML entity (as it should)....

A fix could be provided by checking if the > is on a new line and not followed before < which could be a script etc and kept as a >

To ensure block quote's get rendered. As well not posing a risk to a user / developer / website by replacing all &gt; to non HTML entities....

EDIT: again to clarify I am currently replacing my &gt; with > after conversion. There is NO need for this.. And this is certainly a bug / feature request that needs to be dealt with... I would highly suggest leaving this issue open...

paviad commented 2 years ago

Doesn't showdown convert markdown to HTML and not the other way around?

You should be converting > into <blockquote> and not vice versa. So the > should be in your input.

I think your use case is different than mine. That is why I do not understand your meaning all the way.

paviad commented 2 years ago

I don't feel comfortable leaving this issue open when it is not really the issue I was facing, and also I don't fully understand your use case.

I'd rather you open a new issue and describe your use case in more detail.