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

Confusion between html and xml syntax in documentation #27661

Closed
Judekeyser opened this issue Jun 29, 2023 · 3 comments
Closed

Confusion between html and xml syntax in documentation #27661

Judekeyser opened this issue Jun 29, 2023 · 3 comments
Labels
closed: question A user misinterpretation or support question. No action required. Content:Learn Learning area docs

Comments

@Judekeyser
Copy link

Judekeyser commented Jun 29, 2023

MDN URL

https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics

What specific section or headline is this issue about?

all document

What information was incorrect, unhelpful, or incomplete?

Most examples are phrased with XML syntax for HTML5, but do not contain XML preamble. In addition, nothing is made to warn the reader about the requirement to serve those documents as XML.

What did you expect to see?

Could examples be phrased using html syntax, to avoid ambiguity? Or could there be a section that explains that for self-closing elements (void elements), the two syntaxes are possible?

In pages like:
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled
for example, the two syntaxes coexist, which might give the feeling that something is wrong.

Do you have any supporting links, references, or citations?

The other syntax that can be used for HTML is XML. This syntax is compatible with XHTML1 documents and implementations. Documents using this syntax need to be served with an XML media type (such as application/xhtml+xml or application/xml) and elements need to be put in the http://www.w3.org/1999/xhtml namespace following the rules set forth by the XML specifications. [XML] [XMLNS]

Source: https://www.w3.org/TR/html5-diff/#syntax

@Judekeyser Judekeyser added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 29, 2023
@github-actions github-actions bot added the Content:Learn Learning area docs label Jun 29, 2023
@yarusome
Copy link
Contributor

About using XML syntax for HTML codes:

This is because Firefox and MDN now officially endorse the use of Prettier to format every type of codes, including HTML, and Prettier keeps refusing using the HTML-native syntax for HTML (see prettier/prettier#5246) 😅 (I guess they don't bother to implement namespace-scoped linting.)

About coexistence of both syntaxes:

If you're referring to the Try it section using no trailing slashes for void elements, it's because the code there lives in mdn/interactive-examples, which hasn't been manipulated by Prettier yet.

@Josh-Cena
Copy link
Member

Right, code here is valid HTML. Trailing slashes don't make them XML. We don't plan to deviate from Prettier style here. See https://github.com/orgs/mdn/discussions/242

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Jun 30, 2023
@Josh-Cena Josh-Cena added closed: question A user misinterpretation or support question. No action required. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 30, 2023
@Judekeyser
Copy link
Author

@Josh-Cena I understand. Couldnt there at least be a section that stresses the two variations and refers to the "void element" page?

How is a beginner supposed to get in touch with the two alternatives?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed: question A user misinterpretation or support question. No action required. Content:Learn Learning area docs
Projects
None yet
Development

No branches or pull requests

3 participants