@amamo/mdx 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/shiki.js CHANGED
@@ -61,6 +61,7 @@ export async function createShikiRenderer(config) {
61
61
  throw new Error('AMAMO_SHIKI_DISPOSED: Shiki renderer is disposed');
62
62
  const languages = await Promise.all(blocks.map((block) => loadLanguage(block.lang)));
63
63
  return blocks.map((block, index) => {
64
+ const language = block.lang;
64
65
  const hast = highlighter.codeToHast(block.code, {
65
66
  colorReplacements: config.colorReplacements,
66
67
  defaultColor: false,
@@ -70,6 +71,17 @@ export async function createShikiRenderer(config) {
70
71
  dark: config.themes.dark,
71
72
  light: config.themes.light,
72
73
  },
74
+ transformers: language && !['text', 'plain', 'plaintext'].includes(language)
75
+ ? [
76
+ {
77
+ pre(node) {
78
+ const classes = String(node.properties.class ?? '').split(' ');
79
+ classes.push(`language-${language}`);
80
+ node.properties.class = classes.filter(Boolean).join(' ');
81
+ },
82
+ },
83
+ ]
84
+ : undefined,
73
85
  });
74
86
  return {
75
87
  blockId: block.blockId,
package/dist/vite.js CHANGED
@@ -73,9 +73,6 @@ export function amamoMdx(config) {
73
73
  }
74
74
  });
75
75
  },
76
- async closeBundle() {
77
- await dispose();
78
- },
79
76
  };
80
77
  }
81
78
  function invalidateGeneratedModule(server, compiler) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amamo/mdx",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A native MDX content compiler with Vite and Next adapters",
5
5
  "homepage": "https://jikkai.github.io/mdx/",
6
6
  "license": "MIT",
@@ -113,12 +113,12 @@
113
113
  },
114
114
  "packageManager": "pnpm@11.20.0",
115
115
  "optionalDependencies": {
116
- "@amamo/mdx-darwin-arm64": "0.1.1",
117
- "@amamo/mdx-darwin-x64": "0.1.1",
118
- "@amamo/mdx-linux-arm64-gnu": "0.1.1",
119
- "@amamo/mdx-linux-x64-gnu": "0.1.1",
120
- "@amamo/mdx-linux-arm64-musl": "0.1.1",
121
- "@amamo/mdx-linux-x64-musl": "0.1.1",
122
- "@amamo/mdx-win32-x64-msvc": "0.1.1"
116
+ "@amamo/mdx-darwin-arm64": "0.1.3",
117
+ "@amamo/mdx-darwin-x64": "0.1.3",
118
+ "@amamo/mdx-linux-arm64-gnu": "0.1.3",
119
+ "@amamo/mdx-linux-x64-gnu": "0.1.3",
120
+ "@amamo/mdx-linux-arm64-musl": "0.1.3",
121
+ "@amamo/mdx-linux-x64-musl": "0.1.3",
122
+ "@amamo/mdx-win32-x64-msvc": "0.1.3"
123
123
  }
124
124
  }