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

⌨️ Code cell options can have caption #1726

Merged
merged 2 commits into from
Jan 6, 2025
Merged

⌨️ Code cell options can have caption #1726

merged 2 commits into from
Jan 6, 2025

Conversation

rowanc1
Copy link
Member

@rowanc1 rowanc1 commented Jan 6, 2025

We already allow this for options defined with the #| caption: syntax, this expands to being allowed in the code-block options as well.

Copy link

changeset-bot bot commented Jan 6, 2025

🦋 Changeset detected

Latest commit: 4e2412c

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

This PR includes changesets to release 5 packages
Name Type
myst-directives Patch
myst-transforms Patch
myst-parser Patch
myst-roles Patch
myst-to-html 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

Copy link
Collaborator

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

This looks great! Though I am also confused as isn't this already possible? Here's a screenshot that seems to show a code block with a caption:

https://mystmd.org/guide/code#code-blocks

CleanShot 2025-01-06 at 08 51 52@2x

@rowanc1
Copy link
Member Author

rowanc1 commented Jan 6, 2025

This is code-cell! Not code.

@choldgraf choldgraf changed the title ⌨️ Code block options can have caption ⌨️ Code cell options can have caption Jan 6, 2025
@choldgraf
Copy link
Collaborator

choldgraf commented Jan 6, 2025

Oh nice! I updated the PR title as I think you meant "cell" and that was what confused me. The PR looks good to go from me but I had a quick question for feedback:

When we merge this, it'll auto-populate our docs here right? https://mystmd.org/guide/directives#directive-code-cell

Thinking through the documentation strategy, does this sound correct to you:

  • PRs like this should be "auto-documented" as much as possible in mystmd.org, that way we know that all possible configuration options are documented in the mystmd guide. (as is the case with this PR)
  • Over time, we should elevate the "reference" section of mystmd.org/guide so that it is easier to discover and these auto-documented tables about directives etc make up the bulk of the docs.
  • Over time, we should migrate the "non-reference" content over to Jupyter Book, and the remaining MyST guide content should be more like the "auto-documented tables" along with a "basic usage" example for each directive / role.
  • When PRs like this get merged, we should decide whether it's important enough to add to a "how to" example there (in this case, I'd actually suggest we need to document the :caption: flag for code blocks, and assume that users can figure it out for themselves that it works for code cells)

Does that sound right?

@rowanc1
Copy link
Member Author

rowanc1 commented Jan 6, 2025

Yes, docs autoupdate for all directive options.

I have added additional docs about the caption.

The mystmd docs should also be stand-alone from Jupyter Book (i.e. a user coming to mystmd.org can get up and running with the myst cli with the relevant tutorials, without having to know about jupyter book), so there still needs to be some guides and tutorials in the mystmd docs, just more of a focus on reference material over time. This will likely become more clear as JBv2 gets released fully and has more docs focused on building books and how-tos etc.

@rowanc1 rowanc1 merged commit 9717b06 into main Jan 6, 2025
7 checks passed
@rowanc1 rowanc1 deleted the code/caption branch January 6, 2025 20:01
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