Fix fallback language remark plugin #10118
Merged
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (required)
This PR fixes the
remarkFallbackLang
remark plugin used to marks links to fallback language pages.Repro:
Inhalte zu erstellen
link should be marked and displayed asInhalte 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 inhast-util-raw
or theparse5
tokenizer (used internally) and it requires a raw node to either include an element or a whitespace (e.g. (EN)
or<span> (EN)</span>
instead of (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
and I'll open later a proper issue on the related repo.Related issues & labels (optional)