Skip to content

Commit 0e09568

Browse files
committed
Remove unnecessary whitespace from markdown-formatted help, and use the most appropriate quote type for inline code.
1 parent a45ee5a commit 0e09568

9 files changed

+3
-21
lines changed

consolekit/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpF
169169
doc = block_token.Document(self.help or '')
170170

171171
with TerminalRenderer() as renderer:
172-
rendered_doc = indent(renderer.render(doc), " ")
172+
rendered_doc = indent(renderer.render(doc).strip(), " ")
173173

174174
if resolve_color_default(self._colour) is False:
175175
# Also remove 'COMBINING LONG STROKE OVERLAY', used for strikethrough.

consolekit/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def render_inline_code(self, token: span_token.InlineCode) -> str:
382382
"""
383383

384384
# TODO: A better implementation
385-
return f"'{self.render_inner(token)}'"
385+
return f"{self.render_inner(token)!r}"
386386

387387
def render_strikethrough(self, token: span_token.Strikethrough) -> str:
388388
"""

tests/test_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def test_markdown_help_command_pycharm(
213213
runner = CliRunner()
214214

215215
result: Result = runner.invoke(markdown_demo_command, catch_exceptions=False, args=["--help"], color=True)
216-
check_file_regression(result.stdout.rstrip(), file_regression)
216+
check_file_regression(result.stdout.rstrip(), file_regression, extension=".md")
217217

218218

219219
def test_private_helpers(monkeypatch):
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
Usage: demo [OPTIONS]
22

3-
43
This is the summary line.
54

65
This program does the 'following':
76
* This
87
* That
98
* T̶h̶e̶ ̶o̶t̶h̶e̶r̶ (deprecated)
109

11-
12-
1310
Options:
1411
-h, --help Show this message and exit.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
Usage: demo [OPTIONS]
22

3-
43
This is the summary line.
54

65
This program does the 'following':
76
1. This
87
2. That
98
3. The other (deprecated)
109

11-
12-
1310
Options:
1411
--colour / --no-colour Whether to use coloured output.
1512
-h, --help Show this message and exit.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
Usage: demo [OPTIONS]
22

3-
43
This is the summary line.
54

65
This program does the 'following':
76
1. This
87
2. That
98
3. T̶h̶e̶ ̶o̶t̶h̶e̶r̶ (deprecated)
109

11-
12-
1310
Options:
1411
-h, --help Show this message and exit.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
Usage: demo [OPTIONS]
22

3-
43
This is the summary line.
54

65
This program does 𝘵𝘩𝘦 'following':
76
* This
87
* That
98
* The other (deprecated)
109

11-
12-
1310
Options:
1411
-h, --help Show this message and exit.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
Usage: foo [OPTIONS]
22

3-
43
This is the summary line.
54

65
This program does the 'following':
76
* This
87
* That
98
* T̶h̶e̶ ̶o̶t̶h̶e̶r̶ (deprecated)
109

11-
12-
1310
Options:
1411
--help Show this message and exit.

tests/test_commands_/test_markdown_help_group_group.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
Usage: demo [OPTIONS] COMMAND [ARGS]...
22

3-
43
This is the summary line.
54

65
This program does the 'following':
76
* This
87
* That
98
* T̶h̶e̶ ̶o̶t̶h̶e̶r̶ (deprecated)
109

11-
12-
1310
Options:
1411
-h, --help Show this message and exit.
1512

0 commit comments

Comments
 (0)