The point is that IDs/classes/attributes are part of the content, not presentation. Since they should be describing the content semantically rather than just providing stylistic information.
You shouldn’t do things like add class
right like you do in your example from 266, but add a class that describes more specifically what type of image it actually is, content-wise, and then in the css refer to that class when doing
The curly braces section should be optional, therefore, if users don’t need it, it doesn’t complicate the syntax for them.
The case for having the content writer specify the id/class would be because the elements themselves are inherently (content-wise, semantically) different than the rest of the elements which of are of the same type. The content writer needs to somehow be able to specify this so that the presentation of it can be changed/controlled if desired.
The filename as an unique identifier for images doesn’t work because you can’t select that with css. Even if you could, your css would have to include image file names, which is inflexible since a filename might change. Classes can be applied to multiple images and don’t have to change with a filename change.
It does work for headings (generating IDs from the heading text itself) since headings (of the same type) are all usually styled the same way. The reason for unique identifiers for headings is usually due to anchoring.
Original post says to change syntax from:
but that obviously has backward compatiblity issues since many already use the former syntax. I think what mb21 proposes can still be achieved though:
For code blocks, keep the ability to have the former syntax.
- If ID’s or other attributes are needed, you’ll need to surround them in curly braces after the language class/declaration.
- This may be a needed differentiation for code blocks since, if 136 is accepted, the initial language declaration (
ruby in this case) would be changed to
language-ruby, instead of just a
ruby class if
.ruby was in curly braces.
- And if you don’t want this change from
language-ruby for whatever reason (if you don’t want a language declaration at all), you can just omit it, but you’ll have to use curly braces to add IDs/classes/attributes to differentiate between that.
But for headings or other elements, where the attributes would need to be added on the same line as the heading/content itself, curly braces should be required for adding attributes so that it doesn’t conflict with normal heading/content text.
Edit: 136 has been accepted, so the old syntax definitely needs to stay otherwise there would be conflicts.