Skip to content

Commit

Permalink
Merge branch 'main' into ensure-outdir-assetsdir-treeshaking
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt authored Mar 26, 2024
2 parents e902914 + 54c2f97 commit a13f575
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-dolls-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Updates the `HTMLAttributes` type exported from `astro` to allow data attributes
6 changes: 6 additions & 0 deletions .changeset/eighty-pumpkins-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@astrojs/markdown-remark": patch
---

This patch allows Shiki to use all of its reserved languages instead of the
previous behavior of forcing unknown languages to plaintext.
5 changes: 4 additions & 1 deletion packages/astro/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import type { Simplify } from './dist/type-utils.js';

/** Any supported HTML or SVG element name, as defined by the HTML specification */
export type HTMLTag = keyof astroHTML.JSX.DefinedIntrinsicElements;

/** The built-in attributes for any known HTML or SVG element name */
export type HTMLAttributes<Tag extends HTMLTag> = Omit<
astroHTML.JSX.IntrinsicElements[Tag],
keyof Omit<AstroBuiltinAttributes, 'class:list'>
>;
> & {
[key: string]: string | number | boolean | null | undefined;
};

/**
* All the CSS properties available, as defined by the CSS specification
Expand Down
4 changes: 2 additions & 2 deletions packages/markdown/remark/src/shiki.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Properties } from 'hast';
import { bundledLanguages, createCssVariablesTheme, getHighlighter } from 'shiki';
import { bundledLanguages, createCssVariablesTheme, getHighlighter, isSpecialLang } from 'shiki';
import { visit } from 'unist-util-visit';
import type { ShikiConfig } from './types.js';

Expand Down Expand Up @@ -51,7 +51,7 @@ export async function createShikiHighlighter({

return {
highlight(code, lang = 'plaintext', options) {
if (lang !== 'plaintext' && !loadedLanguages.includes(lang)) {
if (!isSpecialLang(lang) && !loadedLanguages.includes(lang)) {
// eslint-disable-next-line no-console
console.warn(`[Shiki] The language "${lang}" doesn't exist, falling back to "plaintext".`);
lang = 'plaintext';
Expand Down

0 comments on commit a13f575

Please sign in to comment.