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

Use semantic constructs for paragraphs #3970

Open
ggrossetie opened this issue Mar 20, 2021 · 2 comments
Open

Use semantic constructs for paragraphs #3970

ggrossetie opened this issue Mar 20, 2021 · 2 comments
Assignees
Labels
area/html-next Issues related to the next generation HTML converter

Comments

@ggrossetie
Copy link
Member

This issue will be addressed as part of: #242

Paragraph

I think this is an easy one, we should enclose the content in a <p> element.

<p><!-- content --></p>

Role

I think we shouldn't add a default role on paragraph blocks but rather always use specific roles when a <p> element is used in other contexts.

Title

In AsciiDoc, you can assign a title to a paragraph:

.Famous intro
A long time ago in a galaxy far, far away.

strong element

I think we should avoid enclosing the paragraph element in a meaningless container (such as <div>).
Since a <p> element only permits phrasing content, I believe that <strong> is a good choice.
In publishing, the formal name for this construct is a "run-in heading". See:

A run-in heading is a heading positioned upon the very same line as the text. Frequently this text is put in either italic or bold type.

The advantage of strong is that it comes prestyled (compared to span).

<p><strong class="title">Famous intro</strong> A long time ago in a galaxy far, far away.</p>

image

In the above example, the strong element has a default role "title".
Instead, we could also use the name "head" but I feel like "title" is probably more obvious.

Alternatives

heading element

While it may seem like the right solution, my concern is that we would use the same construct for level 6 section titles and block titles. Also, keep in mind that:

heading information can be used by user agents to construct a table of contents for a document automatically.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/heading_elements#usage_notes

So it would mean that block titles will be part of the document outline.

In addition, an heading element is not a phrasing content so the heading element will inevitably be outside of the paragraph element:

<h6>Famous intro</h6>
<p>A long time ago in a galaxy far, far away.</p>
@ggrossetie
Copy link
Member Author

Researches from @mojavelinux about title on paragraph:

What I discovered is that in publishing, there is no such thing as a title on a paragraph. There is only a run-in heading. Not a single book I could find ever did anything different, and there is no reference to being able to add a caption to a paragraph in any official manual of style (Chicago, New York, MLA, etc). So we can only reasonably conclude that a title on a paragraph as defined in AsciiDoc is, in fact, a run-in heading. (And even then, they are extremely rare).

The two main uses for them are:
To emphasize text at the start of the paragraph (think of it like the primary subject)
As the deepest heading level, with the intent that it is hidden from the outline/toc; almost like a discrete heading

@mojavelinux
Copy link
Member

I want to cite some occurrences of existing approaches for reference.

The Asciidoctor EPUB3 converter implements the proposed structure (the strong element), but assigns to it the class name "head" rather than "title". However, I don't think "head" is the right choice here as it's too easily confused with "running head", which is something entirely different.

The XHTML output from the DocBook toolchain also uses the strong element (so we're definitely seeing a pattern), but does not assign a class name to it at all. Without a class name, it cannot be distinguished from a strong/bold phrase at the start of the paragraph, so I don't think that's the right choice either. In the DocBook structure, the element is designated using the term "title". See https://tdg.docbook.org/tdg/5.1/formalpara.html.

The closest thing in DITA is the fig element, which can be used to assign a caption to an arbitrary element (e.g., fig > title + p). Again, we see the term "title" come up. But now we're looking at a something fundamentally different because it's presenting the paragraph as an exhibit. Since a caption is not really the same thing as a run-in heading, we may decide to use a different structure in AsciiDoc (a fig block) to handle that use case.

Having looked at these approaches, I'd say unless there's a really compelling example of using another term to use that we don't know about, I think "title" is the right choice here and we should proceed with it.

@ggrossetie ggrossetie self-assigned this Mar 21, 2021
@ggrossetie ggrossetie moved this from To do to Review in progress in Create Modern HTML Converter Mar 21, 2021
@ggrossetie ggrossetie added the area/html-next Issues related to the next generation HTML converter label Apr 21, 2021
@ggrossetie ggrossetie moved this from Review in progress to Done in Create Modern HTML Converter May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/html-next Issues related to the next generation HTML converter
Development

No branches or pull requests

2 participants