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

ENH Add a css wrapper to generated types #397

Merged
merged 1 commit into from Nov 9, 2023

Conversation

hoodmane
Copy link
Collaborator

@hoodmane hoodmane commented Nov 8, 2023

Resolves issue #395.

Here's a screenshot where I've used this in Pyodide's docs to add some ugly css to the types:

Screenshot from 2023-11-07 16-25-51

@@ -209,7 +210,7 @@ def format_annotation(annotation: Any, config: Config) -> str: # noqa: C901, PL
fully_qualified: bool = getattr(config, "typehints_fully_qualified", False)
prefix = "" if fully_qualified or full_name == class_name else "~"
role = "data" if module == "typing" and class_name in _PYDATA_ANNOTATIONS else "class"
args_format = "\\[{}]"
args_format = "\\ \\[{}]"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe it would be better to use r here and in lots of other places: r"\ \[{}]" would have half as many slashes...

@pfebrer
Copy link

pfebrer commented Nov 8, 2023

I didn't know you could create a role like that, that's nice to know :)

@gaborbernat gaborbernat merged commit 9735dc6 into tox-dev:main Nov 9, 2023
10 checks passed
@hoodmane hoodmane deleted the css-wrapper branch November 9, 2023 21:54
@gaborbernat
Copy link
Member

@hoodmane for some reason this broke tox documentation on TypeVar:

image

https://github.com/tox-dev/tox/actions/runs/6822355429/job/18554265718

Any idea why is that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants