Replies: 5 comments 21 replies
-
@dipikabh asked whether there was history about the names of the sections, since our current "Syntax" block is not really syntax definition as all, but more like examples of the syntax. IIRC originally there was only what we now call "Formal syntax", and it was called just "Syntax": https://web.archive.org/web/20140305011542/https://developer.mozilla.org/en-US/docs/Web/CSS/border#Syntax. We wanted to have a more approachable/readable way to show the syntax, and added these sections giving example syntax. Then we needed a new name for the original syntax, so it got the name "formal syntax": https://web.archive.org/web/20180530112352/https://developer.mozilla.org/en-US/docs/Web/CSS/border#Syntax. I still like the "example syntax" and think that probably for most people most of the time it's more likely to be useful than the formal syntax. I think now we could perhaps have something like:
|
Beta Was this translation helpful? Give feedback.
-
Porting the slack discussion here for everybody's eyes and opinions:
I would like to consider grouping "syntax usage", "fs", "values" under an H2, to emphasise the fact that they are part of the same aspect of the documentation (and distinct from say BCD or Specs). And I'm not sure "Syntax usage" needs a heading. Also I think mockups help with this 🙂 |
Beta Was this translation helpful? Give feedback.
-
I think this is an important point, I did a litmus test when we started considering webref for formal syntax instead of data. Most of the feedback was the same when asked whether users take note of the the formal syntax sections, like: "Hardly ever! Can be pretty baffling on some longer entries." That's not to say I'm against moving it as I think categorically it does fit better within the syntax and values parts. But maybe we should consider which parts of a CSS reference page are the most useful for our users (I assume this is why the original change was made) |
Beta Was this translation helpful? Give feedback.
-
Based on the sections that are most helpful to readers, how about the order somewhat along the lines of what's described here. This proposal does not take into account if there'll be any implementation hiccups (in content or platform), just throwing ideas out there. Also, not sure if this will be extendable to JS docs.
Using https://developer.mozilla.org/en-US/docs/Web/CSS/animation-delay#syntax as an example here. ## Try it
// interactive example
## Usage
/* For a single animation */
/* animation-delay: <time>; */
animation-delay: 3s;
animation-delay: -1500ms;
/* For multiple animations */
/* animation-delay: <time>, <time>; */
animation-delay: 2.1s, 480ms;
## Parameters
// dl
## Description
## Examples
## Specifications
// url table
### Formal syntax
### Formal definition
## Browser compatibility
## See also
Consider another page https://developer.mozilla.org/en-US/docs/Web/CSS/border-style#syntax.
## Try it
// interactive example
## Constituent properties
## Usage
/* 1 value applies to all sides */
/* border-style: <line-style>; */
border-style: dotted;
/* 3 values apply to top | left and right | bottom */
/* border-style: <line-style> <line-style> <line-style>; */
border-style: hidden double dashed;
...
## Parameters
// dl
// also mention the global values that this property can be assigned
## Description
## Examples
## Specifications
// url table
### Formal syntax
### Formal definition
## Browser compatibility
## See also
|
Beta Was this translation helpful? Give feedback.
-
The crucial point here is that different reader groups have different expectations for the "Syntax" section. There're at least two groups:
Some threads here are focusing on a single group, but it's better to accommodate both. Another issue I found during the work on CSS Color Module is that the current structure makes it awkward to explain functional notations, e.g. starting the "Values" section with a note on the syntax as on the Therefore, I think the proposed structures could be further tweaked like this: ## Syntax
[{Optional} Intuitive rephrasing of the syntax here][1]
[Current "Formal syntax" here][2]
### Values
### "Examples" (<- A bad name for a placeholder, current "Syntax" here)
## Definition
[Current "Formal definition" here] [1] serves Group 1 and functionnal notations, and [2] serves Group 2. However, there're some caveats:
The culprits for Point 2 are:
In case the formal syntax is still too lengthy after the above optimizations, a last resort is to set Incidentally, I'm working on an automation script to diff mdn/data and webref so that future updates to mdn/data could be much easier. A demo with Code: <pre class="notranslate" style="white-space: pre-wrap;"><span class="token property" id="<display-internal>"><display-internal> = </span><br><span style="display: inline-block;"> <span class="token keyword">table-row-group</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-header-group</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-footer-group</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-row</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-cell</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-column-group</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-column</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">table-caption</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">ruby-base</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">ruby-text</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">ruby-base-container</span> <a href="/en-US/docs/Web/CSS/Value_definition_syntax#single_bar" title="Single bar: exactly one of the entities must be present">|</a></span><span style="display: inline-block;"> <span class="token keyword">ruby-text-container</span> </span><br></pre> Given the above format, if extra-long items are allowed to occupy more than one column, there arises an interesting math problem to decide the most economical column width. |
Beta Was this translation helpful? Give feedback.
-
In the old days, on CSS pages, the formal syntax section came before the "Values" section, inside "Syntax":
The "Values" section described items listed in the formal syntax.
Because formal syntax was hard to read, we decided to move it further down the page in favour of more informal descriptions, first into a section just after "Values":
...then eventually to its own top-level section, miles away from "Values":
This causes coherency problems in our pages: the "Values" section still refers to things that are introduced in the formal syntax (e.g.
<line-width>
in the example above). In fact these two sections are quite closely linked.I wonder if, now the formal syntax is easier to read, we should move it back before the "Values" section, so these two sections can work better again.
Beta Was this translation helpful? Give feedback.
All reactions