Skip to content

Commit

Permalink
fix readme and static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Dec 17, 2023
1 parent d3fa40c commit 4a5e505
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ justified is acceptable:

.. code-block::
poetry run isort sphinxcontrib
poetry run isort sphinxcontrib/typer
poetry run black sphinxcontrib/typer
poetry run pytest
poetry run doc8 -q doc
Expand Down
8 changes: 2 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,8 @@ You could change ``:preferred:`` to svg, to generate svg instead:

|
Or to text:

.. raw:: html

<pre><span></span>
Or to text::
Usage: example [OPTIONS] COMMAND [ARGS]...
This is the callback function.
Expand All @@ -146,7 +143,6 @@ Or to text:
│ bar This is the bar command. │
│ foo This is the foo command. │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
</pre>


The ``typer`` directive has options for generating docs for all subcommands as well
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pytest-cov = "^4.1.0"
doc8 = "^1.1.1"
black = "^23.12.0"
mypy = "^1.7.1"
readme-renderer = "^42.0"
readme-renderer = {extras = ["md"], version = "^42.0"}
aiohttp = "^3.9.1"


Expand Down
6 changes: 1 addition & 5 deletions sphinxcontrib/typer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,6 @@ def convert_png(
top = location['y'] * pixel_ratio
if directive.target is RenderTarget.TEXT:
# getting the width of the text is actually a bit tricky
# thanks chatgpt!!
script = """
const pre = arguments[0];
const textContent = pre.textContent || pre.innerText;
Expand All @@ -699,10 +698,7 @@ def convert_png(
temporarySpan.style.whiteSpace = 'pre';
temporarySpan.textContent = textContent;
// Measure width
const width = temporarySpan.offsetWidth;
document.body.removeChild(temporarySpan);
return width;
return temporarySpan.offsetWidth;
"""
width = driver.execute_script(script, element)
right = left + width * pixel_ratio
Expand Down

0 comments on commit 4a5e505

Please sign in to comment.