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

Blockquotes #5

Closed
mntn-xyz opened this issue Aug 9, 2021 · 4 comments · Fixed by #8
Closed

Blockquotes #5

mntn-xyz opened this issue Aug 9, 2021 · 4 comments · Fixed by #8
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@mntn-xyz
Copy link
Contributor

mntn-xyz commented Aug 9, 2021

Just wanted to note a couple of issues:

  • Multiline blockquotes don't render properly; renderer should be able to handle line breaks and blank quoted lines
  • HTML tags in blockquotes are not stripped (the typical Hugo markdown example page uses <br> and <cite> which are present in the output)
@tdemin
Copy link
Owner

tdemin commented Aug 12, 2021

@mntn-xyz first of all, sorry for taking that much of a while to respond, the last few days were quite a time. :-D

Removing line breaks in blockquotes is an intended behaviour, as there's no line length limit in Gemtext documents, and Gemini spec strongly recommends allowing clients to soft wrap text; therefore text in blockquotes is treated the same way general text is; see internal/gemini/renderer.go#L91 (it calls (Renderer).text(), which strips line breaks). To be honest, I see no good way to keep author's line breaks in text while staying compatible with the Gemtext soft wrapping premise; do you?

Blank quotes are indeed an issue and do cause a panic, thanks to the (faulty) logic of (Renderer).blockquote() always expecting at least a single paragraph. While checking this I also discovered an apparent issue of more than one blockquote being merged by gomarkdown into one and then the rest of blockquotes getting ignored (I honestly didn't think of more than one paragraph in a single blockquote, hence the logic of (Renderer).blockquote() and the bug).

HTML tags in blockquotes being kept appears to be a gomarkdown issue, because the logic for paragraph/blockquote text extraction is in essence the same: calling (Renderer).text() after a bit of heuristical extraction of actual paragraphs containing text. I'll probably open a separate issue for this one and investigate if it's actually upstream causing this.

md2gmn blockquote test

@tdemin tdemin added bug Something isn't working question Further information is requested labels Aug 12, 2021
@tdemin tdemin added this to the 0.2.0 milestone Aug 12, 2021
@mntn-xyz
Copy link
Contributor Author

No problem, thanks for getting back to me! I'm just glad you're maintaining this, I think it will be useful for spreading Gemini adoption.

So on line breaks, it is true that the Gemini spec says that "quoted content is written as a single line". But it doesn't say that you can't put one quote right after another, and generally blockquotes are often used to output more than one line or paragraph.

To me, the most obvious use cases for multiline blockquotes are multi-paragraph quotes and poetry. You can find some examples here: gemini://whither.smol.pub/quotes. Some clients render these as multiline blockquotes (with wrapping!) while some simply display them as plain text lines. Currently the vulpes.one proxy just wraps each line, and it looks funny but it's technically in spec: https://proxy.vulpes.one/gemini/whither.smol.pub/quotes

In fact it isn't required for Gemini clients to render these lines any differently than normal text: "It is strictly optional for clients to do anything special at all with blockquotes, and some clients will treat them just like any other line of text." Since lines of text support newlines (they are inserted verbatim), it follows that newlines should be supported here as well.

For what it's worth, I think this should be clarified in the official Gemini spec.

tdemin added a commit that referenced this issue Aug 13, 2021
While renderer previously assumed there would always be a single
paragraph inside the blockquote, there sometimes can be either more or
none.

See #5.
tdemin added a commit that referenced this issue Aug 13, 2021
This makes the renderer preserve existing line breaks in blockquotes,
provided they do not split paragraphs. Some clients/sites may use this
to form semantic around line breaks (for instance, for poems).

See #5.
@tdemin tdemin linked a pull request Aug 13, 2021 that will close this issue
@tdemin
Copy link
Owner

tdemin commented Aug 13, 2021

@mntn-xyz looks good to you?

@mntn-xyz
Copy link
Contributor Author

I would consider that fixed!

tdemin added a commit that referenced this issue Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants