-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Italicizing non-literal syntax? #1500
Comments
Or does that not work when attempt 1: attempt 2: Hmm. Seems to be hard to get them to work nicely together, to mix italicized and unitalicized in code block. Understandable, I guess, <code> mode being literal and unformatted and all. But maybe there's a nice elegant way? |
Indeed, making things italic isn't a very good idea, because it doesn't look good. Is there a real need and confusion here? |
I don't see why it has to not look good. It doesn't seem to work with backticks, but in regular HTML, having, for instance,
Which I think looks fine, and is also the way, for instance, Mozilla represents such things on their MDN web docs site. And yes, I think it really helps to have the variable/shorthand portion of the code easily distinguished from the literal syntax part, especially when the syntax is being encountered for the first time and/or the reader is not accustomed to the conventions being used for variables and shorthand expressions. And that not having that can lead to confusion. This was, for instance, the case when I was having issues some time back with the use of 'var', 'arr', 'obj', etc. in code examples. I figured it out, but it slowed me down. |
I strongly agree with the previous comment. I think Furthermore, although I also think italics are fine, they are just a default styling. Using It’s flexible—and semantic! :-) |
How about, when showing syntax like:
node.append(...nodes or strings) – append nodes or strings at the end of node,
node.prepend(...nodes or strings) – insert nodes or strings into the beginning of node,
that "node" (in this case), or whatever syntax is not literal, that is, that stands for some general type of thing, be put in italics, i.e., in this case, to have instead:
node.append(...nodes or strings) – append nodes or strings at the end of node,
node.prepend(...nodes or strings) – insert nodes or strings into the beginning of node,
(From: https://javascript.info/modifying-document)
I think that would make the meaning of the syntax clearer. Also, this is what MDN does in their Syntax descriptions, e.g.:
element.appendChild(aChild);
https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
This would also address some of my earlier concerns with the use of "str", "array", "obj", etc. from a couple months ago.
The text was updated successfully, but these errors were encountered: