Skip to content

Conversation

@choldgraf
Copy link
Contributor

@choldgraf choldgraf commented Nov 24, 2025

New inline images (we didn't have an example before so I added one):

CleanShot 2025-11-24 at 13 57 17@2x

@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: 4e70519

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

This PR includes changesets to release 15 packages
Name Type
myst-to-react Patch
@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/search Patch
@myst-theme/search-minisearch Patch
@myst-theme/landing-pages Patch
@myst-theme/book Patch
@myst-theme/article 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

@netlify
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for myst-theme ready!

Name Link
🔨 Latest commit 4e70519
🔍 Latest deploy log https://app.netlify.com/projects/myst-theme/deploys/6926209709a4f80008e9e9ac
😎 Deploy Preview https://deploy-preview-710--myst-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@choldgraf choldgraf changed the title Document inline images and build instructions Fix inline images and caption centering and add build instructions Nov 24, 2025
@stefanv
Copy link
Collaborator

stefanv commented Nov 24, 2025

The PR captions says "Centers figure captions under the figure", but I don't see that in the screenshot. Presumably, captions are meant to remain left-aligned?

@choldgraf
Copy link
Contributor Author

I'm working on the screenshot! needed netlify to finish building

@choldgraf
Copy link
Contributor Author

@stefanv ok check the PR body again

```

This is a requirement of the way our static site is generated.
It expects to find a built theme locally, and the `myst start --headless` command below will error if it isn't done at least once.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you build the theme, then it should not be necessary to run a separate content/theme server.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, can we pull this out into another PR, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but myst start --headless will not find the theme that is coded in myst.yml and will barf at you.

I can make this another PR. IMO that is unnecessary toil for a very small docs improvement but I'll do so now.

font-size: 1.4rem;
}
/* Center captions for standard figures to match centered images */
figure:not(.fig-quote) figcaption {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to make sure I understand: is this CSS rule sufficient to capture all cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I figured out a more targeted rule to just capture the figure directive case, because I realized that we're using <figure> in a few other ways as well (like pull quotes)

.prose dd img {
margin: 0;
display: inline-block;
vertical-align: text-bottom;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm maybe I should just remove this and not be opinionated about it until we see what behavior people expect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed all the CSS rules possible!

display: inline-block;
vertical-align: text-bottom;
max-height: 1.2em;
width: auto;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Required?

package.json Outdated
"compile": "turbo run compile",
"build": "turbo run build",
"dev": "turbo run dev --parallel --filter='./packages/*'",
"dev": "turbo run dev --parallel --filter='./packages/*' --filter=@myst-theme/styles",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind making a separate PR for unrelated changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out this wasn't necessary after all! I, an idiot, was running my theme server in the wrong folder because I'm using worktrees

@stefanv
Copy link
Collaborator

stefanv commented Nov 24, 2025

Central captioning looks better, indeed so 👍

@choldgraf choldgraf changed the title Fix inline images and caption centering and add build instructions Fix inline images and figure caption centering and add build instructions Nov 24, 2025
@choldgraf
Copy link
Contributor Author

OK I figured out some improvements:

  • We now have a more targeted rule for the figure centering stuff.
  • We left-justify the text, but center it with width: fit-content so it should now center under the image, BUT also be left-justified.

@choldgraf choldgraf changed the title Fix inline images and figure caption centering and add build instructions Fix inline images and figure caption centering Nov 24, 2025
docs/myst.yml Outdated
children:
- pattern: 'reference/!(index)*.md'
- file: developer/index.md
- title: Developer documentation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unintended change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no developer/index.md so I saw an error! Do you want me to make another PR for this one too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, darnit... I have the index.md lying around.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will make PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@akhmerov
Copy link

akhmerov commented Nov 25, 2025

I believe this PR fixes #94 as well

@agoose77
Copy link
Collaborator

Thanks for the work @choldgraf and @stefanv!

I think we need to be a bit cautious on the basis that caption centering is a fairly big visual change, so it would be nice to discuss it a little.

When I saw changes to caption centering, I did some digging into the existing MyST behaviour — because I prefer the behaviour to JB1. Here's an example of what I think feels like a regression vs HEAD:

image

vs

image

I think my preference is:

  • Left aligned text (text-align: left)
  • Left justified text (margin-left: 0)

My preference sits in contrast to the defaults with subfigures in LaTeX, so I'm happy to acknowledge that I might be the odd one out. If that's the case, can we do something to improve the primary caption's visual precedence?

Maybe it just needs to be slightly bigger (or, subcaptions to be slightly smaller) e.g.
image

@choldgraf
Copy link
Contributor Author

choldgraf commented Nov 25, 2025

If the captions are going to require discussion then I will move them into a different PR. IMO, the current behavior is a bug but if @agoose77 thinks it's a feature we can discuss.

Here's the PR around figure captions:

For design decisions, I'd like us to have a design reference we can point to in order to make these decisions, so that it doesn't come down to individual team member preference. What is the design inspiration for the MyST Theme?

If there is a clear path forward given to me in that one, I can put some cycles into trying to achieve it. But just being honest here: I don't have a ton of time to do back-and-forths with conflicting and subjective design opinions, so if we don't have a clear direction I'll probably just leave the behavior as-is and drop that PR (any body else is welcome to pick it up and put it over the finish line though)

@choldgraf choldgraf changed the title Fix inline images and figure caption centering Fix inline images Nov 25, 2025
@stefanv
Copy link
Collaborator

stefanv commented Nov 25, 2025

Given that @choldgraf pulled out the figure caption changes that require further discussion, this one should be good to go.

@agoose77 agoose77 merged commit bd19488 into jupyter-book:main Nov 25, 2025
2 of 3 checks passed
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.

Images that are given in-line still have line-breaks not enough space after an image

4 participants