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

Allow asides titles to contain markdown formatting #2126

Merged
merged 8 commits into from
Jul 23, 2024

Conversation

essential-randomness
Copy link
Contributor

Description

Fixes a bug where aside titles would get cut out if any markdown formatting was added in them.

Markdown of aside with formatting:
image
Before the fix
image
After the fix
image

I took the liberty to add mdast-util-to-string as a dependency. You already had hast-util-to-string so I assumed this would be fine and better than writing bespoke code to handle nested formatting. Let me know if you want me to remove it.

Copy link

changeset-bot bot commented Jul 12, 2024

🦋 Changeset detected

Latest commit: 7fc5570

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

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight 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

This comment was marked as outdated.

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Jul 12, 2024
Copy link

netlify bot commented Jul 12, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 7fc5570
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/669fa44d74df080008378aef
😎 Deploy Preview https://deploy-preview-2126--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@astrobot-houston
Copy link
Collaborator

Hello! Thank you for opening your first PR to Starlight! ✨

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel 🤩

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@HiDeoo
Copy link
Member

HiDeoo commented Jul 17, 2024

Thanks a lot for your contribution 🙌

I did not yet dive in detail into the changes, altho they seems pretty straightforward at first glance (except maybe the lock file changes, looks like quite a few deps got updated).

One thing I'd like to point out and discuss before moving forward is the <Aside/> component. This would be a difference in behavior/features between the directive syntax and the component syntax.

I guess there are several possibilities to handle this, e.g. only support this for the directive syntax like in the current implementation, or also support it for the component syntax. I think I'm personally leaning towards the latter, but I'd like to hear people's opinions on this.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks @essential-randomness! This looks great.

Regarding @HiDeoo’s question about what to do about <Aside>, that’s a great question!

My initial thought was “we can just require HTML there and use set:html” — i.e. usage like

<Aside title="Custom <code>code</code> label">

But then we’ll still need to strip out the HTML for the aria-label. That may still be preferable to supporting full-on Markdown rendering there though?

Also curious whether people think it’s OK to merge this before fixing support in <Aside>?

.changeset/mean-tigers-hunt.md Outdated Show resolved Hide resolved
@HiDeoo
Copy link
Member

HiDeoo commented Jul 22, 2024

That may still be preferable to supporting full-on Markdown rendering there though?

I think so, this would align with the banner behavior for example and would be way more practical than let's say a slot.

Also curious whether people think it’s OK to merge this before fixing support in <Aside>?

I personally think it's fine to merge this first, my comment was more about pointing out the potential difference and discuss it rather than having it block this PR.

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks again for the PR @essential-randomness! Happy with this and then we can think about how to tackle <Aside> support in a similar vein if and when it is needed.

@delucis delucis added the 🌟 patch Change that triggers a patch release label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants