jgm / djot

A light markup language
https://djot.net
MIT License
1.73k stars 43 forks source link

Blockquote attribution / citation #198

Open toastal opened 1 year ago

toastal commented 1 year ago

> denotes a <blockquote> in Markdown/Djot

The blockquote element represents a section that is quoted from another source.

Content inside a blockquote must be quoted from another source, whose address, if it has one, may be cited in the cite attribute.

— W3C HTML spec, https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element

As a user, I want syntax explicitly support attributing and citing blockquotes. This not only matches the HTML spec closer, but it's good to cite your sources! With explicit syntax it would be much easier to support styling that author information instead of it being in some generic <p> that can't reasonable be selected (made up CSS selector: blockquote + p:has(:where(text-begins-with("—"), text-begins-with("--"))) or the last paragraph inside if nested. The point being having a consistent pattern will make it easier to group together with the blockquote and handle the blockquote accordingly instead of using ad-hoc conventions.


Prior art: Asciidoctor

AsciiDoc Block syntax

[quote,Monty Python and the Holy Grail]
____
Dennis: Come and see the violence inherent in the system. Help! Help! I'm being repressed!

King Arthur: Bloody peasant!

Dennis: Oh, what a giveaway! Did you hear that? Did you hear that, eh? That's what I'm on about! Did you see him repressing me? You saw him, Didn't you?
____

AsciiDoc Markdown-style

> I hold it that a little rebellion now and then is a good thing,
> and as necessary in the political world as storms in the physical.
> -- Thomas Jefferson, Papers of Thomas Jefferson: Volume 11

Prior art: reStructuredText

As a great paleontologist once said,

    This theory, that is mine, is mine.

    -- Anne Elk (Miss)

This all said, (em dash) seems to be the preferred symbol for quotation attribution and Djot uses triple hyphen, ---, for that symbol (and base AsciiDoc uses --).

For rendering, it still seems a bit unclear if attribution should live inside or outside of the <blockquote>, wrapped in a <div> or in a <figure> with <figcation> to cite (and there's the <cite> tag itself).

Omikhleia commented 1 year ago

This may also tangentially relate to https://github.com/jgm/djot/issues/28#issuecomment-1535554065 if captions were generalized:

> I hold it that a little rebellion now and then is a good thing,
> and as necessary in the political world as storms in the physical.
^ Thomas Jefferson, _Papers of Thomas Jefferson_. Volume 11

I opted for that option, with a modified version of the Djot reader, in my Djot for SILE renderer (then styling such quotes as "epigraphs") -- but this is admittedly a workaround to fit my typesetting needs, until some consensus is reached.

gfarrell commented 8 months ago

FWIW I started implementing something similar in my own markdownish language using a tilde:

> Something intelligent said about markup languages
~ Not me

The text after the tilde can contain other syntax elements like citations etc. (so you could have something like ~ [+@foo, p. 33] as per #32).