Problem/Motivation

State what you believe is wrong or missing from the current standards.

Benefits

If we adopted this change, the Drupal Project would benefit by ...

Three supporters required

  1. https://www.drupal.org/u/{userid} (yyyy-mm-dd they added support)
  2. https://www.drupal.org/u/{userid} (yyyy-mm-dd they added support)
  3. https://www.drupal.org/u/{userid} (yyyy-mm-dd they added support)

Proposed changes

See #5

The original proposal had these options

... the SPAN element
... the span element
... the <span> element

1. {link to the documentation heading that is to change}

Current text

Add current text in blockquotes

Proposed text

When referring to HTML tags by name in textual documentation, always use angle brackets, lowercase, and no closing tag, e.g.: <em>. If you are providing a code snippet, use @code/@endcode instead.

2. Repeat the above for each page or sub-page that needs to be changed.

Remaining tasks

  1. Create this issue in the Coding Standards queue, using the defined template
  2. Add supporters
  3. Create a Change Record
  4. Review by the Coding Standards Committee
  5. Coding Standards Committee takes action as required
  6. Discussed by the Core Committer Committee, if it impacts Drupal Core
  7. Final review by Coding Standards Committee
  8. Documentation updates
    1. Edit all pages
    2. Publish change record
    3. Remove 'Needs documentation edits' tag
  9. If applicable, create follow-up issues for PHPCS rules/sniffs changes

For a full explanation of these steps see the Coding Standards project page

Comments

joachim created an issue. See original summary.

jhodgdon’s picture

Just to clarify a few things:

a) I think that this proposal is limited to making a standard for how to refer to HTML tags in PHP API documentation (the doc blocks in files). Correct?

b) Assuming that is the case, I would also note that the API module is fine with things like

/**
 * Outputs a <p> tag.
...

or things like that -- and by "fine with" I mean that it will output it as &lt;p&gt; so that it looks like <p> on the api.drupal.org page.

Anyway, I think the issue summary needs an update to clarify the scope of this question.

joachim’s picture

Title: add a standard for referring to HTML tags » add a standard for referring to HTML tags in code documentation

> I think that this proposal is limited to making a standard for how to refer to HTML tags in PHP API documentation (the doc blocks in files). Correct?

Yup. Retitling, but feel free to improve if you like.

jhodgdon’s picture

On #2546248: Use consistent style to mention HTML tags in code comments, we discussed this, and it was noted that most places in Core, we are just putting the tag in verbatim. Example would be:

 ... part of a documentation block
 * This produces an <li> tag ...

This seems to be the de-facto standard, and the API module handles this type of comment fine on api.drupal.org. So, if we are going to adopt a standard, that is the standard I think we should adopt.

xjm’s picture

Issue summary: View changes

We just committed a cleanup related to this in #2546248: Use consistent style to mention HTML tags in code comments. In that issue, we implicitly adopt the standard to always use lowercase and angle brackets in comments.

I took a stab at describing the standard adopted there:

When referring to HTML tags by name in textual documentation, always use angle brackets, lowercase, and no closing tag, e.g.: <em>. If you are providing a code snippet, use @code/@endcode instead.

We could also create a rule that checks for uppercase tags, e.g. <HTML>, and indicates that they should be lowercase.

andypost’s picture

Suppose we need a new sniffer and child issue for #2571965: [meta] Fix PHP coding standards in core, stage 1 to apply the sniffer

quietone’s picture

Component: Documentation » Coding Standards
Issue summary: View changes

Convert to new template.

This needs to suggest the page where the proposed text is to be added.

xjm’s picture

Amending attribution.