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

🎁 Use commonDirectiveOptions in all directives #1650

Merged
merged 14 commits into from
Nov 20, 2024

Conversation

agoose77
Copy link
Contributor

@agoose77 agoose77 commented Nov 18, 2024

This PR tackles #1657. We will need an upstream myst-theme PR to ensure that these are actually set in the DOM.

I omitted the documentation directives {myst:role} et al. I didn't think they needed it.

Copy link

changeset-bot bot commented Nov 18, 2024

🦋 Changeset detected

Latest commit: 826df5b

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

This PR includes changesets to release 9 packages
Name Type
myst-ext-exercise Patch
myst-directives Patch
myst-ext-proof Patch
myst-ext-grid Patch
myst-ext-tabs Patch
myst-parser Patch
myst-roles Patch
myst-to-html Patch
myst-transforms 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
Contributor Author

@fwkoch can you help clarify the changeset semver policy? I'm not clear for mystmd when we can make a minor bump.

@agoose77 agoose77 marked this pull request as ready for review November 19, 2024 12:17
@agoose77
Copy link
Contributor Author

Requires jupyter-book/myst-theme#500 to see some of the improvements.

@fwkoch
Copy link
Collaborator

fwkoch commented Nov 19, 2024

I put my thoughts about the semver policy here: #1658 - nothing official in that yet, just my opinions!

Copy link
Collaborator

@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.

This is really nice for adding class to all node types, it adds that feature while simplifying the code.

My only hesitation is that it also adds enumerated/enumerator to all the node types. To me, this feels slightly less general than class, which is just a transparent string that themes may or may not support...

Enumeration gets picked up by the enumerate transforms and impacts the mdast processing. Testing a little bit, it seems ok... good actually... I can now enumerate many things that I could not before, and it seems to just work. However, it makes the scope of this PR bigger than it might seem at first - it doesn't just add some simple properties to directives, it enriches (hopefully without breaking) fairly significant myst functionality.

Anyway, after going through all this, I'm still approving - I don't actually think there is a problem! Mostly just had to wrap my head around the implications of enumerated.

@@ -11,11 +11,7 @@ export const asideDirective: DirectiveSpec = {
doc: 'An optional title',
},
options: {
...labelDirectiveOption('aside'),
// TODO: Add enumeration in future
Copy link
Collaborator

Choose a reason for hiding this comment

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

This gets added to the node now too!

packages/myst-ext-exercise/src/exercise.ts Show resolved Hide resolved
@agoose77
Copy link
Contributor Author

Yes @fwkoch, and helpful of you to explicitly surface that change --I made the same judgment that it feels like we should be able to identify and reference most (all) directives, but that isn't a small conceptual change by any means.

Copy link
Collaborator

@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.

Just thinking a little more about some documentation loose ends here...

packages/myst-ext-exercise/src/exercise.ts Show resolved Hide resolved
packages/myst-ext-exercise/src/exercise.ts Show resolved Hide resolved
packages/myst-ext-proof/src/proof.ts Show resolved Hide resolved
@agoose77
Copy link
Contributor Author

agoose77 commented Nov 20, 2024

@fwkoch thanks for your review! Really good catch on the enumerated - nonumber overlap! I've updated the directives to prefer nonumber to enumerated, but respect the latter if given.

I've also reworked the docs to use {myst} or tabs for pairing syntax and rendered examples. I removed reference to sphinx-exercise, because at this point we are unifying things in a breaking manner, and we're trying to distance ourselves from the notion that MyST is 100% compatible with Sphinx.

If you are OK with these changes, please merge the PR!


Removes the directive from the final output.
:::{myst:directive} exercise
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great to be using this here now! Thank you!!

docs/exercises.md Outdated Show resolved Hide resolved
@fwkoch
Copy link
Collaborator

fwkoch commented Nov 20, 2024

The last thing I did was add commonDirectiveOptions to solution directive. I think that makes sense - you can now have, for example, Solution 1 and Solution 2 which may both be solutions to Exercise 1.

@fwkoch fwkoch merged commit d7a6fdd into main Nov 20, 2024
7 checks passed
@fwkoch fwkoch deleted the agoose77/feat-add-directive-class-all branch November 20, 2024 17:47
@agoose77
Copy link
Contributor Author

@fwkoch thank you for catching those mistakes. Fab.

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.

2 participants