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

🪄 Add more class support to directives #500

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

agoose77
Copy link
Collaborator

This PR should increase the number of directives that support class and identifier in rendering. I doubt I've got them all, but I created a test case from the directives list: https://mystmd.org/guide/directives

Details
:::{aside} An Optional Title
:class: red

This is an aside. It is not entirely relevant to the main article.
:::

:::{tip}
:class: red
Try changing `tip` to `warning`!
:::

:::{bibliography}
:class: red

:::

:::{blockquote}
:name: quote
:class: red

Hello

-- world
:::

:::{code} python
:class: red

x + y
:::

:::{div}
:class: red

div
:::

:::{dropdown}
:class: red

dropdown
:::

:::{embed} #quote
:class: red

:::

:::{figure} https://picsum.photos/512
:class: red

:::

:::{glossary}
:class: red

Foo
: Bar

:::

:::{iframe} https://google.com
:class: red
:::

:::{include} test.md
:class: red

:::

:::{mermaid}
:class: red

graph LR;
dot --> dash;
:::

```{myst}
:class: red

Try this!
```

```{table}
:class: red

| Month    | Savings |
| -------- | ------- |
| January  | $250    |
| February | $80     |
| March    | $420    |

```

Copy link

changeset-bot bot commented Nov 19, 2024

🦋 Changeset detected

Latest commit: 196e7ba

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

This PR includes changesets to release 14 packages
Name Type
@myst-theme/diagrams Patch
myst-demo Patch
myst-to-react Patch
@myst-theme/providers Patch
@myst-theme/frontmatter Patch
@myst-theme/jupyter Patch
@myst-theme/site Patch
@myst-theme/styles Patch
@myst-theme/common Patch
@myst-theme/icons Patch
@myst-theme/search Patch
@myst-theme/search-minisearch Patch
@myst-theme/book Patch
@myst-theme/article 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
Copy link
Collaborator Author

Could someone clarify whether we expect AST nodes to always have html_id, or whether the current fallback pattern
node.html_id || node.identifier is expected? I mentioned this somewhere else (probably Discord), but I don't think we touched upon it.

@rowanc1
Copy link
Member

rowanc1 commented Nov 19, 2024

If there is an identifier, there should be an html_id always. If there isn't that is a bug. Those in the theme and there for legacy likely., or if we need the node to be identified, prefer the I'd and fall back to the key in the order: html_id, identifier, key.

Copy link
Contributor

@fwkoch fwkoch left a comment

Choose a reason for hiding this comment

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

Nice, all pretty simple stuff, propagating classes, identifiers, etc in more places.

@agoose77 agoose77 merged commit fdccb23 into main Nov 19, 2024
2 checks passed
@agoose77 agoose77 deleted the agoose77/feat-more-class-support branch November 19, 2024 22:09
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.

3 participants