Skip to content

How should inline source text be written? #3862

@gibson042

Description

@gibson042

We're pretty consistent about writing block examples as 21.3 Code Listings:

<pre><code class="javascript">
  let str = "1 + 1;";
  eval(str);
  eval(str);
</code></pre>

But as far as I can tell, there's no preferred form for inline code. Many sites use `…` (as seen in e.g. [Source Text Module Records](https://tc39.es/ecma262/#table-exportentry-records)), but that doesn't seem right to me. Many other sites use <code>…</code> (e.g., implementation-approximated), which seems better. But <code>…</code> is also used for references to external files/symbols/etc. (as in e.g. String.prototype.toLowerCase ( ), ShallowestContainedJSONValue, and Shared Memory Guidelines), and it would be nice to distinguish those uses.

I think something like <code class="javascript">…</code> would be ideal, even if the class has no effect on rendering.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions