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

Fix fallback language remark plugin #10118

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Nov 29, 2024

Description (required)

This PR fixes the remarkFallbackLang remark plugin used to marks links to fallback language pages.

Repro:

  1. Visit https://docs.astro.build/de/guides/cms/#kann-ich-astro-ohne-cms-nutzen
  2. The Inhalte zu erstellen link should be marked and displayed as Inhalte zu erstellen (EN) as it's linking to a fallback language page in English.
    The Integration link in the previous section is correctly not marked as it's linking to a page in German.

This plugin broke with Astro 4.0.0-beta.0 due to to all the updates to the unified, remark and rehype dependencies in withastro/astro#9138. It looks like the issue is located either in hast-util-raw or the parse5 tokenizer (used internally) and it requires a raw node to either include an element or a whitespace (e.g. &nbsp; (EN) or <span>&nbsp;(EN)</span> instead of &nbsp;(EN) would work).

This PR workaround the issue by switching to a text node using the non-breaking space unicode character U+00A0 instead of the HTML entity &nbsp; and I'll open later a proper issue on the related repo.

Related issues & labels (optional)

  • Closes #
  • Suggested label: bug

Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 9577a1c
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/6749ec747abdd30008f1730f
😎 Deploy Preview https://deploy-preview-10118--astro-docs-2.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 site configuration.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Can confirm it's now working in the deploy preview! 🥳

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 a) for noticing this was broken, b) for fixing it, and c) for trekking through the entire unified.js cinematic universe on a quest for the infinity token 🙌

@HiDeoo HiDeoo merged commit 1cb70c4 into withastro:main Nov 30, 2024
11 checks passed
@HiDeoo HiDeoo deleted the hd-fix-remark-fallback-lang branch November 30, 2024 12:58
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.

None yet

3 participants