jupyter-book / myst-theme

Packages for creating MyST websites themes using React and Remix
https://jupyter-book.github.io/myst-theme/?path=/docs/components-introduction--docs
MIT License
12 stars 12 forks source link

:cat2: Add built-in styling for Sphinx-annotated ASTs #443

Closed agoose77 closed 4 weeks ago

agoose77 commented 1 month ago

In #431 I explored adding pass-through rendering support for Sphinx AST nodes (generated from a separate extension for Sphinx). This PR instead looks for annotations on a canonical MyST AST to make the styling required to improve Sphinx rendering. Currently this is only focused on autodoc nodes.

There are some limitations in our AST right now that make this a bit fiddly, namely that many node types don't support custom classes. Consequently, some of the selectors are more like heuristics, but they are all gated on a parent class starting with sphinx-.

1722518444-wayshot 1722518425-wayshot 1722518401-wayshot

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: caa99a406fc77f9130ca351b34823844ca9bcd9d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages | Name | Type | | ----------------------- | ----- | | @myst-theme/styles | Patch | | @myst-theme/providers | Patch | | @myst-theme/frontmatter | Patch | | @myst-theme/diagrams | Patch | | @myst-theme/jupyter | Patch | | @myst-theme/site | Patch | | @myst-theme/common | Patch | | @myst-theme/icons | Patch | | @myst-theme/book | Patch | | @myst-theme/article | Patch | | myst-to-react | Patch | | myst-demo | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

agoose77 commented 1 month ago

This styling isn't perfect, but it's simple enough to start with.