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

Link to Astro docs for heading anchor link generation #1010

Merged
merged 6 commits into from
Nov 17, 2023

Conversation

onurusluca
Copy link
Contributor

@onurusluca onurusluca commented Nov 1, 2023

What kind of changes does this PR include?

  • Changes or translations of Starlight docs site content

Description

It may be difficult to understand how to correctly set anchor links for some people.

Update authoring-content.md about automatic anchoring to clarify that automatic anchor links only accepts lowecase anchors with no space.

Added:

:::note
**Convert to Lowercase:** Even if your title has uppercase characters, write them in the anchor link with lowercase. `Title` > `title`
<br/>
**No Spaces in Titles:** If your title has spaces, replace spaces with hyphens(-). `My Title` > `my-title`
:::

…ly accepts lowecase anchors with no space

Added:

:::note
**Convert to Lowercase:** Ensure that all characters in the heading titles used for anchor links are in lowercase.
<br/>
**No Spaces in Titles:** Titles with spaces cannot be used as anchor links. Consider using hyphens to separate words (my-section instead of My Section) for better compatibility.
:::
Copy link

changeset-bot bot commented Nov 1, 2023

⚠️ No Changeset found

Latest commit: 968746f

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

Copy link

netlify bot commented Nov 1, 2023

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 239068c
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/654a13bea62e3a0008d7f92b
😎 Deploy Preview https://deploy-preview-1010--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.

@github-actions github-actions bot added the 📚 docs Documentation website changes label Nov 1, 2023
Copy link
Collaborator

@astrobot-houston astrobot-houston left a comment

Choose a reason for hiding this comment

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

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 Netlify 🤩

  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.

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.

Thank you for the PR @onurusluca! The heading ID generator does a few more things — it is based on https://github.com/Flet/github-slugger. I also wonder whether it would be better to document this on the Astro docs Markdown page and link to it? We just use Astro’s default anchor link behaviour, so it’s not Starlight specific. What do you think?

@onurusluca
Copy link
Contributor Author

@delucist Thanks for the reply.
I see, I didn't know Starlight used Astro's anchor link that is based on github slugger.

We can definitely link to the page. Let me fix the commit.
Thanks for asking btw.

@onurusluca
Copy link
Contributor Author

@delucis Is this better maybe? You are welcome to change it.

:::note
Convert to Lowercase: Even if your title has uppercase characters, write them in the anchor link with lowercase. Title > title

No Spaces in Titles: If your title has spaces, replace spaces with hyphens(-).
My Title > my-title

Starlight uses the same Heading IDS logic
as Astro which is based on github-slugger .
:::

@ElianCodes
Copy link
Member

Hey there @onurusluca! I've made a PR to the Astro docs itself. I feel like that's a better place to document this, since it's the same behaviour for both Starlight and Astro.

We can link to that page from Starlight. How does that sound?

PR here: withastro/docs#5300

Copy link
Member

@ElianCodes ElianCodes left a comment

Choose a reason for hiding this comment

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

Since I added this piece of documentation to the main Astro Docs, we can link to that instead of writing it out here.

docs/src/content/docs/guides/authoring-content.md Outdated Show resolved Hide resolved
@onurusluca
Copy link
Contributor Author

onurusluca commented Nov 7, 2023

Hey there @onurusluca! I've made a PR to the Astro docs itself. I feel like that's a better place to document this, since it's the same behaviour for both Starlight and Astro.

We can link to that page from Starlight. How does that sound?

PR here: withastro/docs#5300

@ElianCodes
Thanks for the PR. That looks fine to me.
Sorry for not opening a PR earlier. Completely forgot.

Thanks a lot.

Also thanks for the fix-upm

Gonna close this as it was handled at Astro docs which is a better solution than this.

@onurusluca onurusluca closed this Nov 7, 2023
@HiDeoo
Copy link
Member

HiDeoo commented Nov 7, 2023

No worries at all, altho I still think we do want to link to the new explanation in the Astro Docs as @ElianCodes suggested so I'm gonna reopen this PR to double check that.

@HiDeoo HiDeoo reopened this Nov 7, 2023
Co-authored-by: Elian <hello@elian.codes>
Copy link

vercel bot commented Nov 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
starlight ✅ Ready (Inspect) Visit Preview Nov 17, 2023 0:11am

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 everyone for the work on this PR — I think this looks good now 🙌

@delucis delucis changed the title Update authoring-content.md to clarify that automatic anchor links on… Link to Astro docs for heading anchor link generation Nov 17, 2023
@delucis delucis merged commit 9ed034b into withastro:main Nov 17, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 docs Documentation website changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants