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

Fixes: Shiki syntax highlighting adds is:raw attribute to the HTML output #8715

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Conversation

cprass
Copy link
Contributor

@cprass cprass commented Oct 1, 2023

I recently ran my page through the W3C validator and it showed me a bunch of errors and warnings about is:raw being not allowed. Afaik is:raw is an Astro specific directive that should now appear on the static page output.

The raw-attribute appears only in the Shiki highlighted syntax.

To reproduce it, you can use this template https://stackblitz.com/github/withastro/astro/tree/latest/examples/with-markdown-shiki

Changes

I removed the part of the shiki plugin that adds the is:raw to the pre-tags. The fact that is:raw is in the HTML output implies that is:raw or a similar mechanic is already used higher up the chain.

Testing

I added a Mocha test to verify the fix.

Docs

The attribute is hidden from the user and only visible when inspecting the page HTML. Browsers seem to ignore it and it only appeared as a "problem" when running a HTML validator on the page.

@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2023

🦋 Changeset detected

Latest commit: c4016fa

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

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

@github-actions github-actions bot added the feat: markdown Related to Markdown (scope) label Oct 1, 2023
@ematipico ematipico requested a review from bluwy October 3, 2023 13:38
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

It looks good to me, but I would prefer to defer the merge and review to @bluwy

.changeset/cuddly-vans-reply.md Outdated Show resolved Hide resolved
cprass and others added 2 commits October 4, 2023 09:45
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

LGTM. Seems like an artifact from the Astro-flavoured markdown days.

@bluwy bluwy merged commit 21f4826 into withastro:main Oct 4, 2023
12 of 13 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Oct 4, 2023
martrapp pushed a commit that referenced this pull request Oct 4, 2023
…tput (#8715)

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: markdown Related to Markdown (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants