-
Notifications
You must be signed in to change notification settings - Fork 36
Fix inline images #710
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
Fix inline images #710
Conversation
🦋 Changeset detectedLatest commit: 4e70519 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
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 |
✅ Deploy Preview for myst-theme ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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? |
|
I'm working on the screenshot! needed netlify to finish building |
|
@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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
styles/figures.css
Outdated
| font-size: 1.4rem; | ||
| } | ||
| /* Center captions for standard figures to match centered images */ | ||
| figure:not(.fig-quote) figcaption { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
styles/typography.css
Outdated
| .prose dd img { | ||
| margin: 0; | ||
| display: inline-block; | ||
| vertical-align: text-bottom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want text-bottom or baseline?
https://www.w3schools.com/cssref/tryit.php?filename=trycss_vertical-align
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
styles/typography.css
Outdated
| display: inline-block; | ||
| vertical-align: text-bottom; | ||
| max-height: 1.2em; | ||
| width: auto; |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
Central captioning looks better, indeed so 👍 |
|
OK I figured out some improvements:
|
docs/myst.yml
Outdated
| children: | ||
| - pattern: 'reference/!(index)*.md' | ||
| - file: developer/index.md | ||
| - title: Developer documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unintended change?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I believe this PR fixes #94 as well |
|
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:
vs
I think my preference is:
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. |
|
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) |
|
Given that @choldgraf pulled out the figure caption changes that require further discussion, this one should be good to go. |



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