Skip to content

Conversation

@choldgraf
Copy link
Collaborator

@choldgraf choldgraf commented Dec 4, 2025

Now when buttons don't have a link specified (e.g. {button}`Text`) it emits a span with .button class instead of a link button that is empty.

Right now this won't be styled so this PR adds a style to it:

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

⚠️ No Changeset found

Latest commit: be82614

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the bug Something isn't working label Dec 4, 2025
* - `{button}`<text>`` => button links to `text`, shows `text`.
* - `{button}`text<label>`` => button links to `label`, shows `text`.
*/
const bodyTargetMatch = BODY_TARGET_PATTERN.exec(body);
Copy link
Collaborator

@stefanv stefanv Dec 4, 2025

Choose a reason for hiding this comment

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

Instead of two regexs, why not match on the standard pattern: text<link>, and then do the logic of figuring out what to display: if is empty, show text, if text is empty, show link.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I.e., two groups, one for text, one for link, including triangle brackets. Then can check if link == <> and in that case render nothing for the link.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had split it into two just to be really explicit because the last REGEX I found pretty opaque, but then again I find all regexes opaque, so sounds good I will revert back to a one-liner :-)

@choldgraf
Copy link
Collaborator Author

choldgraf commented Dec 5, 2025

OK this is now two PRs - one for myst-theme, I updated the body to have links etc. I think the failing test is that flaky DOI test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Button role with no link shows as an empty button

3 participants