Skip to content
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

Issue#390 - bold commands in codeblocks #413

Conversation

jherrman
Copy link
Contributor

@jherrman jherrman commented Oct 2, 2023

Update draft for #390

Copy link
Collaborator

@bergerhoffer bergerhoffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this PR! Added some initial feedback.

@@ -104,6 +104,42 @@ Write all titles and headings, including the titles of product documentation gui
* _Configuring the node port service range_
* _How to perform an unsupported conversion from a RHEL-derived Linux distribution to RHEL_

[[commands-in-code-blocks]]
== Commands in code blocks
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this up so that it is alphabetical? (Should be first in the file, before "Date formats")

I've also gone back and forth on whether this makes the most sense under formatting, or whether it would be better suited under "Technical examples". It is formatting, but I'm leaning toward the technical examples sense, just so that all of the code block misc is together. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 For Technical examples

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'd say it fits rather well under the "Formatting" section, since "Technical examples" primarily seems to deal with guidelines for the content itself rather than its markup.

Also, the "User-replaced values" parts, which deal with a very much related topic, including code block content (which is why I initially bunched up the new section with them), are under Formatting as well.

[[commands-in-code-blocks]]
== Commands in code blocks

As a default, use bold formatting for commands in code blocks, to visually distinguish them from their lead-in sentences and example outputs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this sentence implies it, but I would add another sentence that states that output should not use bold formatting.

----
====

Disregard this guideline for example when the command is not an important part of what you want to show in the given code block.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get what we're trying to say with this line, but I think this leaves a lot of room for people to ignore this guideline. Maybe we could leave it out?

Or maybe word it differently to state that if you are using bold to emphasize a different item in the code block, you are not required to bold the command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I do want to leave people some room to manoeuvre around this if they feel so inclined. Your suggestion for the wording does make sense, though.

@@ -104,6 +104,42 @@ Write all titles and headings, including the titles of product documentation gui
* _Configuring the node port service range_
* _How to perform an unsupported conversion from a RHEL-derived Linux distribution to RHEL_

[[commands-in-code-blocks]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we also briefly talked about stating to show a single command in a code block. And that if you have multiple commands, they should be broken into separate code blocks.

Should we consider adding an entry for this as well? Not sure if it would make sense to add into this one, or to separate them into different entries?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, that's a topic that falls quite squarely under "Commands in code blocks]", so I'll add a mention of that, too.

== Commands in code blocks

As a default, use bold formatting for commands in code blocks, to visually distinguish them from their lead-in sentences and example outputs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need to clarify that you should still use bold even if there is no example output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, good point.


.Example AsciiDoc: Command and its output in a code block

Verify that the `libvirt` default network is active and configured to start automatically:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe show this as a step, since that's how it would normally appear in a procedure? (If you do, update in the below rendered output as well

Suggested change
Verify that the `libvirt` default network is active and configured to start automatically:
. Verify that the `libvirt` default network is active and configured to start automatically:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just tested this and it seems to break the formatting of the example in the render for some reason. So, given that it's not really important for the example lead-in sentence to be a step, I'd leave it out.

@bergerhoffer bergerhoffer added the Style guideline Topics that add or modify style guidelines label Oct 2, 2023
@@ -104,6 +104,42 @@ Write all titles and headings, including the titles of product documentation gui
* _Configuring the node port service range_
* _How to perform an unsupported conversion from a RHEL-derived Linux distribution to RHEL_

[[commands-in-code-blocks]]
== Commands in code blocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 For Technical examples

----


This renders as:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete sentence. How about: The previous AsciiDoc example outputs as follows?

I'm suggesting this in the event that a new writer scans the RH SSG (to validate term usability) to check for instances of "This renders as" and they then apply it to customer docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exact wording was actually used in multiple other examples in the section, and I just copied it as a "template". Doesn't change the fact that it's an incomplete sentence, so I'll update the other occurrences, too.


Disregard this guideline for example when the command is not an important part of what you want to show in the given code block.

In addition, both in commands and outputs in code blocks, observe the correct mark-up for user-replaced values, as described in xref:user-replaced-values[] and xref:user-replaced-values-xml[].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three "in" instances makes me stop and reread the sentence. How about:

For a command and its output in a code block, observe the correct mark-up for user-replaced values, as described in xref:user-replaced-values[] and xref:user-replaced-values-xml[].

Kudos to Andrea Hoffer and Darragh Fitzmaurice for the feedback
@jherrman
Copy link
Contributor Author

jherrman commented Oct 3, 2023

@bergerhoffer @dfitzmau thank you for the reviews, hopefully the next iteration is a bit ship-shape-er :-)

Diff: f0ddde1

Copy link
Collaborator

@mportman12 mportman12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some suggestions.

jherrman and others added 3 commits October 13, 2023 15:02
Kudos to Miriam Portman for the suggestion

Co-authored-by: Miriam Portman <[email protected]>
Kudos to Miriam Portman for the suggestion

Co-authored-by: Miriam Portman <[email protected]>
Kudos to Miriam Portman for the suggestion

Co-authored-by: Miriam Portman <[email protected]>
@jherrman
Copy link
Contributor Author

Thank you for the reviews @bergerhoffer @dfitzmau @mportman12 ! Your suggested changes have now been applied, feel free to take another look at the diff and merge the PR if everything looks copacetic.

Copy link
Contributor

@bredamc bredamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jherrman Some minor comments for your consideration :)

supplementary_style_guide/style_guidelines/formatting.adoc Outdated Show resolved Hide resolved
supplementary_style_guide/style_guidelines/formatting.adoc Outdated Show resolved Hide resolved
----
====

Do not use bold formatting for the output, unless you need to highlight a specific part of it. When you do emphasize a non-command item in a code block, you are not required to bold the command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Do not use bold formatting for the output, unless you need to highlight a specific part of it. When you do emphasize a non-command item in a code block, you are not required to bold the command.
Do not use bold formatting in the command output. If you need to highlight a specific part of the output, use a different highlighting method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is good guidance. Writers should still be able to use bolded strings in outputs if necessary, especially if in the given code block, the output is more important than the command itself. Also, it would be rather strange to express the same kind of emphasis differently in the very same code block.

Your other suggestions are decidedly improvements, though, thank you :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jherrman Apologies for the delay in replying to your comment. It seems odd to me to say bold the command in one place and not in another, but perhaps I misunderstood the intent of this update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the idea is basically "bold the important part, so that it's visually distinct" - and since the command itself is usually the important part of a CLI example (and the given step in general), it would be the default part do bold. However, when a part of the output is as important as the command in the given context, or more, we should not bar the writer from bolding something else than the command, and potentially even leaving the command un-bolded.

It's entirely possible I did not formulate that clearly enough in the actual source update, though...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jafiala Can you give us an example of what you're thinking of with bolding pieces of the output?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the examples, @jherrman.

I think it's better to highlight such lines in the command output by using a callout instead of bold text? The following example shows callouts (in a code example, but the same method could be used for command output):
https://docs.openshift.com/pipelines/1.13/about/understanding-openshift-pipelines.html

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, callouts do not seem like an optimal solution to me.

  • They are pretty wonky to work with in adoc (for instance can only be at the end of a line, cannot be used out of sequence, one callout cannot be used repeatedly, and they must always have an explanation under the codeblock, AFAIK). Also, Customer Portal stylesheets do not render them very well, currently.

  • When they work as expected, callouts are visually very distinct, which may not always be what you want when highlighting a small part of a command output.

If the general intention behind this update is "bold out the operative/important parts of the code block for greater visual clarity", I would say the output should follow that consistently with the commands. Also, it's easier for writers to internalize and follow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jherrman and @dfitzmau Thank you both! I understand that callouts might not be optimal, but I wonder if we could highlight the command output in some other way rather than by reusing the bold format.

Do you know whether the highlight syntax described here would render correctly in Customer Portal and OpenShift docs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that syntax a few years ago on the CP and it did render, but I was informed to drop it as the yellow highlighting was really distracting. It definetly grabs attention, but it distracts from the surrounding content. I can understand why yellow is a well-adopted colour for safety 💛

Copy link
Contributor Author

@jherrman jherrman Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested out the #highlight# markup earlier today. Renders reasonably well in asciidoctor (though, as Darragh points out, the colour is a bit much), but both bccutil and the Customer Portal stylesheets completely ignore it, unfortunately:

https://dxp-docp-prod.apps.ext-waf.spoke.prod.us-west-2.aws.paas.redhat.com/documentation/en-us/zen_and_zany_asciidoc_training_titles/42/html-single/davozenis_advanced_asciidoc_training/index?lb_target=stage#proc_test-two_assembly_nested-test

Source: https://privatebin.corp.redhat.com/?d7d35e248ea634d9#6icGw5GgEyf71smCmNSsPem7bvZ6CFMBjiLVkA7zi8Uj

supplementary_style_guide/style_guidelines/formatting.adoc Outdated Show resolved Hide resolved
dfitzmau
dfitzmau previously approved these changes Jan 3, 2024
@jherrman jherrman requested a review from mportman12 January 26, 2024 13:52
@jherrman
Copy link
Contributor Author

Hi @mportman12 , I think you need to ack the changes (based on your comments from Oct 11) before the PR can be merged.

Cheers,
J.

@mportman12
Copy link
Collaborator

@jherrman I think you need ACK from Breda, not me. All my comments have been resolved.

mportman12
mportman12 previously approved these changes Jan 26, 2024
Copy link
Collaborator

@mportman12 mportman12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jherrman
Copy link
Contributor Author

@bergerhoffer @dfitzmau (or anyone else with merging privileges), unless you have any other comments or suggestions as to the changes, please consider merging this sooner rather than later - so that this PR and #390 don't bloat their respective queues unnecessarily.

Thanks!
J.

@dfitzmau
Copy link
Contributor

@bergerhoffer @dfitzmau (or anyone else with merging privileges), unless you have any other comments or suggestions as to the changes, please consider merging this sooner rather than later - so that this PR and #390 don't bloat their respective queues unnecessarily.

Thanks! J.

Hi @jherrman . Looks like Andrea is on PTO. I can merge this PR when the 3rd approval tick is provided.

@jherrman
Copy link
Contributor Author

@dfitzmau I see, thank you for the clarification.

@bredamc , unless there are any further improvements that you'd like to see in this PR, could you provide an approval tick, so it can be merged?

Thanks, and have an excellent day!
J.

@bredamc
Copy link
Contributor

bredamc commented Jan 31, 2024

@jherrman Would you mind adding it to the agenda for the SSG meeting today, just to make sure all agree with the proposed change?

@jherrman
Copy link
Contributor Author

@jherrman Would you mind adding it to the agenda for the SSG meeting today, just to make sure all agree with the proposed change?

I won't be able to attend the style guide meeting today due to a QPS meeting, but if that's not an issue, I can definitely pop this on the agenda for discussion. Alternatively, I'd leave it until the next meet-up.

@bredamc
Copy link
Contributor

bredamc commented Jan 31, 2024

I can attend the first 30 minutes of today's meeting if that helps, but I'm happy to wait until you can attend if you prefer? I know you'd like to get this PR merged sooner rather than later, but I am uncomfortable with the text in line 43, as indicated by my comment above, and would like to get the council's opinion.

@jherrman
Copy link
Contributor Author

@bredamc , sounds like a plan :-) I added the issue as the first one to be discussed at today's style meet-up.

@bredamc
Copy link
Contributor

bredamc commented Jan 31, 2024

@jherrman Could you please provide an example of where the proposed formatting would be preferred over a different highlighting method?

@jherrman
Copy link
Contributor Author

@jherrman Could you please provide an example of where the proposed formatting would be preferred over a different highlighting method?

Added some examples to the thread above

@dfitzmau
Copy link
Contributor

dfitzmau commented Feb 1, 2024

@jherrman Could you please provide an example of where the proposed formatting would be preferred over a different highlighting method?

Added some examples to the thread above

On OpenShift, we have a rule of one command per codeblock and the output should also be in its own codeblock. In saying this, I do see some edge cases in OCP docs where bolding some aspects of a large output block would help a customer see what key output lines they need to see to verify a command ran succesfully. The non-essential output would still hold value in that it provides a customer comfort that this output is also expected.

As in a previous comment, callouts could be used, but callouts used with ifdef or ifndef statements can create a held-with-sticky-tape file, as I've found out recently.

@jherrman
Copy link
Contributor Author

jherrman commented Feb 1, 2024

On OpenShift, we have a rule of one command per codeblock and the output should also be in its own codeblock.

If I remember correctly, the stylesheets on https://docs.openshift.com automatically bold out everything in a code block (though probably in different typefaces based on the context). That way, keeping the command and the output together would create a long(ish) block of bolded text, which is not great for visual clarity either - so keeping them separate is very sensible. However, it also seems to create some "textbox bloat", which is something we generally try to avoid when possible. Therefore, given that Customer Portal stylesheets do not use bold typeface automatically, keeping the comand and the output together makes more sense in CP-based docs.

This, nevertheless, raises a good question: Given that the RH SSG does not aim to govern only documentation that resides on the Customer Portal, how much do we want to be prescriptive about matters that may be governed by the stylesheets of the respective documentation site, and thus outside the writer's control?

As in a previous comment, callouts could be used, but callouts used with ifdef or ifndef statements can create a held-with-sticky-tape file, as I've found out recently.

Yeah, callouts do not work super-great in asciidoc in general, in my experience, and unless they are eminently useful in the given context, I usually prefer to avoid them.

@jherrman jherrman dismissed stale reviews from mportman12 and dfitzmau via 9346e54 February 13, 2024 16:54
@jherrman
Copy link
Contributor Author

Based on the discussion on Slack , I've updated the guidelines about bolding in command output - 9346e54

@dfitzmau @bergerhoffer @bredamc , please take a look and either approve the PR or let me know if any other changes are needed.

Cheers,
J.

Copy link
Contributor

@bredamc bredamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for your patience, @jherrman :)

Copy link
Collaborator

@bergerhoffer bergerhoffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


.Example AsciiDoc: A command and its output in a code block

Verify that the `libvirt` default network is active and configured to start automatically:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only feedback is whether this example should actually be shown as a bullet or numbered step. But I don't think that's important enough to hold up the PR over since it has 2 other approvals. Just something to consider if we should adjust in a separate PR or not!

@bergerhoffer
Copy link
Collaborator

3 approvals, merging!

@bergerhoffer bergerhoffer merged commit a225f27 into redhat-documentation:main Feb 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Style guideline Topics that add or modify style guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants