Can HTML quotation and citation be added?

Introduction

I’ve been using CommonMark to make APA forum posts for my classes at UoPeople, and often wonder why quotes aren’t integrated in the same manner that code segments are. Code segments use tilde ~ and the grave accent ` to indicate inline elements or a fenced block, so it seems natural to use quote marks " and apostrophes ' for quotations. In addition, I think it would be useful to classify independent link references as formal citations rather than just a basic anchor element because – well – I use them that way.

Two code segments follow which – hopefully – illustrate the benefit of making quotation syntax for a markdown language similar to CommonMark code syntax – at least for institutions using APA formatting. Is there a way to implement the first code segment so that the second segment is generated without breaking existing parts of the CommonMark spec?

Markdown with blockquote, cite, and q

'''
The HTML <blockquote> Element (or HTML Block Quotation Element)
indicates that the enclosed text is an extended quotation.
Usually, this is rendered visually by indentation (see Notes for
how to change it). A URL for the source of the quotation may be
given using the cite attribute, while a text representation of
the source can be given using the <cite> element.
[Mozilla Contributors, 2018a, para. 1]
'''

Use <cite> to reference another creative work
[Mozilla Contributors, 2018b].

"<q> element indicates ... short inline quotation"
[Mozilla Contributors, 2018c, para. 1].

<!-- References -->

[Mozilla Contributors, 2018a, para. 1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote "<blockquote>. *MDN web docs*."

[Mozilla Contributors, 2018b]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite "<cite>. *MDN web docs*."

[Mozilla Contributors, 2018c, para. 1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q "<q>. *MDN web docs*."

Resulting HTML Code

<blockquote>
The HTML &lt;blockquote&gt; Element (or HTML Block Quotation Element)
indicates that the enclosed text is an extended quotation.
Usually, this is rendered visually by indentation (see Notes for
how to change it). A URL for the source of the quotation may be
given using the cite attribute, while a text representation of
the source can be given using the <cite> element.
<cite><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote" title="<blockquote>. *MDN web docs*.">Mozilla Contributors, 2018a, para. 1</a></cite>
</blockquote>

<p>
Use &lt;cite&gt; to reference another creative work.
<cite><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite" title="<cite>. *MDN web docs*.">Mozilla Contributors, 2018b</a></cite>.
</p>

<p>
<q>&lt;q&gt; element indicates ... short inline quotation.</q>
<cite><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q" title="<q>. *MDN web docs*">Mozilla Contributors, 2018c, para. 1</a></cite>.
</p>

Rendered HTML

The HTML <blockquote> Element (or HTML Block Quotation Element) indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation (see Notes for how to change it). A URL for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the element. Mozilla Contributors, 2018a, para. 1

Use <cite> to reference another creative work. Mozilla Contributors, 2018b.

<q> element indicates ... short inline quotation. Mozilla Contributors, 2018c, para. 1.

Conclusion

Before leaving, I wanted to state some of the obvious complications with this course of action. In the rendered HTML segment of this forum post it is clear that Discourse’s style sheet overwrites the default behavior to surround in-line quotes with quotation marks. As a result, casual readers can’t tell “<q> element indicates … short inline quotation” is a quote! Also, using apostrophes to indicate in-line quotes could impair some writing styles. I, ‘for one’, tend to use apostrophes when paraphrasing ‘a saying’, and translating casual paraphrases into quotes is not desirable.

Furthermore, a choice must be made on how to render quoted HTML or XML because they have the potential to break fences and in-line elements. Personally, I think quoting XML and HTML could potentially be useful. For instance, part of a quoted mathematical proof could be expressed in MathML1. Because of this I suggest HTML and XML should not be sanitized by default. Instead, writers should try to use <code> tags to sanitize undesirable code rendering.

1: Practically speaking MathML quotes are useless without Chrome support, but maybe someday copy-paste mathematics will be a thing!

2 Likes

Yes, I think this syntax would work.

In your example code segments, the only conflict with CommonMark comes from the raw HTML tags – they’d just need to be placed in code spans or escaped.

Also, this syntax has reasonable fallbacks in existing CommonMark. The citations/quotations fall back to ordinary links using only <a>, just without the <cite> or <q> tags. And the triple-quotes render as plaintext quotes ''' – it’s pretty clear that means a quotation.

So an extension should be able to implement this in a way that’s compatible with the spec.