-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
docs: tweak CLI argument help texts #4659
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
docs: tweak CLI argument help texts #4659
Conversation
The "00:00:00" in "Default is 00:00:00." will be in bold style.
Don't show the reStructuredText markup ":option:`foo`" in help content.
Using bulleted lists can avoid unintended syntax highlighting. For "--fs-safe-rules", we will put a part of content into inline code blocks later.
For new users of CLI.
There are some lines starting with two or more spaces contain the options should be links. To achieve it, the following types of lines should not be processed: - Starting with two or more spaces followed by a "%(prog)s"; - Starting with two or more spaces followed by a full-length option; - Starting with an "Example: ".
Thanks for the PR. I'll take a closer look at the changes later. Most of it looks fine, but there's at least one change which I don't agree with. |
Hi @bastimeyer , thanks for your reply.
I guess the change is "docs: adjust string type to avoid doubling symbols" (72c32f1) . To display |
Yes. Strings should not get unnecessarily concatenated. This is very confusing to read, especially if you're mixing f-strings with normal strings. |
I just discovered that "docs: use single-backtick inline code block" (0ac38c8 , or the old commit d02c81e) has fixed a wrong style about backslashes introduced by "docs: use single-backtick inline code block" (0ae409e). Here is the comparison. Before 0ae409e : Man page: $ man ./docs/_build/man/streamlink.1 | grep --after-context=4 -e 'These characters are replaced with'
These characters are replaced with an underscore for the rules in use:
POSIX : \x00-\x1F /
Windows: \x00-\x1F \x7F " * / : < > ? \ |
Webpage:
After 0ae409e : Man page: $ man ./docs/_build/man/streamlink.1 | grep --after-context=4 -e 'These characters are replaced with'
These characters are replaced with an underscore for the rules in use:
• POSIX: x00-x1F /
• Windows: x00-x1F x7F " * / : < > ? |
Webpage:
|
Hi, @bastimeyer , all of my changes are ready to be reviewed. In addition, thank you for rewriting the PR title. Composing a short but clear title is an art. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a deeper look at the changes. Everything's looking fine, thanks.
One minor detail however is how the Example: ...
and Examples:\n ...
sections get rendered in the man page. Since you're now applying inline code after Example:
, stuff gets rendered as highlighted text, whereas the block text does not. That seems to be an issue with Sphinx though, and this can be ignored. Doesn't matter much anyway.
There's also one tiny issue with an unnecessary non-capture group in one of the new regexes, but it's pretty much irrelevant. If you want to fix it, you can do it before this gets merged.
diff --git a/docs/ext_argparse.py b/docs/ext_argparse.py
index 55732fab..2066e57e 100644
--- a/docs/ext_argparse.py
+++ b/docs/ext_argparse.py
@@ -26,7 +26,7 @@ _option_re = re.compile(r"(?:^|(?<=\s))(--\w[\w-]*\w)\b")
_prog_re = re.compile(r"%\(prog\)s")
_percent_re = re.compile(r"%%")
_cli_metadata_variables_section_cross_link_re = re.compile(r"the \"Metadata variables\" section")
-_inline_code_block_re = re.compile(r"(?<!`)`((?:[^`])+?)`")
+_inline_code_block_re = re.compile(r"(?<!`)`([^`]+?)`")
_example_inline_code_block_re = re.compile(r"(?<=^Example: )(.+)$", re.MULTILINE)
Thank you, @bastimeyer . What do you think about the new commit "docs: highlight inline code blocks in single-line examples" (e3dba12)? |
This will make the documentation more clear and informative both on the rendered webpages and in the manpage as well as the "--help" content. - On webpages, we will get inline code blocks; - In the manpage, we will get emphasized words (bold); - In the help content, we will get words enclosed in single backticks. This will help us remove reStructuredText markups from the docs. About "\$A": "\\$A" has been put into a code block, so the single backslash will be displayed correctly in the help content. For rendered docs, escaping backslashes is now no longer required since we did it automatically. --- A useless non-capturing group has been removed as per the suggestion: #4659 (review) Thus, Co-authored-by: bastimeyer <mail@bastimeyer.de>
Only apply to the line starts with "^Example: ".
Force-pushed what:
|
This will make the documentation more clear and informative both on the rendered webpages and in the manpage as well as the "--help" content. - On webpages, we will get inline code blocks; - In the manpage, we will get emphasized words (bold); - In the help content, we will get words enclosed in single backticks. This will help us remove reStructuredText markups from the docs. About "\$A": "\\$A" has been put into a code block, so the single backslash will be displayed correctly in the help content. For rendered docs, escaping backslashes is now no longer required since we did it automatically. --- A useless non-capturing group has been removed as per the suggestion: #4659 (review) Thus, Co-authored-by: bastimeyer <mail@bastimeyer.de>
Thanks |
This will make the documentation more clear and informative both on the rendered webpages and in the manpage as well as the "--help" content. - On webpages, we will get inline code blocks; - In the manpage, we will get emphasized words (bold); - In the help content, we will get words enclosed in single backticks. This will help us remove reStructuredText markups from the docs. About "\$A": "\\$A" has been put into a code block, so the single backslash will be displayed correctly in the help content. For rendered docs, escaping backslashes is now no longer required since we did it automatically. --- A useless non-capturing group has been removed as per the suggestion: streamlink#4659 (review) Thus, Co-Authored-By: bastimeyer <mail@bastimeyer.de>
This will make the documentation more clear and informative both on the rendered webpages and in the manpage as well as the "--help" content. - On webpages, we will get inline code blocks; - In the manpage, we will get emphasized words (bold); - In the help content, we will get words enclosed in single backticks. This will help us remove reStructuredText markups from the docs. About "\$A": "\\$A" has been put into a code block, so the single backslash will be displayed correctly in the help content. For rendered docs, escaping backslashes is now no longer required since we did it automatically. --- A useless non-capturing group has been removed as per the suggestion: streamlink#4659 (review) Thus, Co-authored-by: bastimeyer <mail@bastimeyer.de>
Hi! This PR contains the re-implement of 1e12d02 in #4618 . The comparison are as follows.
1. plugins.nicolive: docs: apply bold style to "--timeshift-offset"
Commit: cfe5b41
Original:
New:
2. docs: use valid or full-length options to create links
Commit: b1c7ac7
Original:
New:
3. docs: use bulleted list to organize content
Commit: 0ae409e
Original:
New:
4. docs: include the option itself in its example
Commit: 9d7e3e3
Original:
New:
5. docs: apply option links in indented lines
Commit: 8a0c23f
Original:
New:
6. docs: add names for special characters
Commit: 1e6217a
Original:
New:
7.
docs: adjust string type to avoid doubling symbolsCommit: 72c32f1 (dropped)
No difference between rendered content.
8. docs: use single-backtick inline code block
Commit: 8eda37d (was 0ac38c8) (was d02c81e)
Group 1: webpage
Original:
New:
Group 2: man page
Original:
New:
Group 3: help content
Original:
New:
9. docs: put inline code to code blocks in examples
Commit: 4ce3cbc (was 00a9c12) (was b70aaf1)
Original:
New: