Skip to content

Commit 755ee09

Browse files
authored
docs: fix code-documentation inconsistencies (#63)
- Fix core/README.md: replace non-existent registerLanguage with actual initHighlighter API - Remove highlight.css references: Shiki themes are controlled via props, not separate CSS imports - Update all CHANGELOG files to remove outdated highlight.css references - Clarify that highlight() is async and returns a Promise - Update migration guide to reflect actual v3 API
1 parent 22222ea commit 755ee09

File tree

10 files changed

+17
-97
lines changed

10 files changed

+17
-97
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ Major changes in v3.0.0 modernize the architecture and usage. Here’s how to up
362362
- After (v3): `import CodeView from 'react-code-view'` or `import { CodeView } from '@react-code-view/react'`
363363
- Styles: Use the new CSS entry points.
364364
- Before (v2): Less files (e.g., `react-code-view/less/styles.less`)
365-
- After (v3): `import 'react-code-view/styles'` and optional syntax theme `import 'react-code-view/styles/highlight'`
365+
- After (v3): `import 'react-code-view/styles'`
366366
- Build tool integration: Replace legacy Webpack markdown loader with the unified unplugin across tools.
367367
- Before (v2): `webpack-md-loader` and custom loader config
368368
- After (v3): `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack (see examples above)

RELEASE_NOTES_v3.0.0.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

examples/vite/src/docs/example.md

Whitespace-only changes.

examples/vite/src/test-parse.js

Whitespace-only changes.

packages/core/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
- `useCodeExecution` effect behavior stabilized; consumers relying on previous implicit re-execution may need to explicitly update `code` or pass `dependencies`
1717
- Package structure reorganized across `packages/*`; import paths may need updates according to exports
1818
- Imports: `CodeView` is now also a default export in `@react-code-view/react` and re-exported by `react-code-view`; prefer `import CodeView from 'react-code-view'` or adjust named imports accordingly
19-
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'` and optional `import 'react-code-view/styles/highlight'`
19+
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'`
2020
- Build integration: Legacy `webpack-md-loader` is removed; migrate to unified `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack
2121
- Tooling: Minimum requirements updated to Node >=18 and PNPM >=8 for the monorepo/dev workflow

packages/core/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ const result = await transformMarkdown(markdown, {
4141
### Direct Highlighting
4242

4343
```js
44-
import { highlight, registerLanguage } from '@react-code-view/core';
44+
import { highlight, initHighlighter } from '@react-code-view/core';
4545

46-
await registerLanguage('python');
46+
// Initialize highlighter (optional, will auto-initialize on first use)
47+
await initHighlighter();
4748

48-
const highlighted = highlight('print("Hello")', { language: 'python' });
49+
const highlighted = await highlight('print("Hello")', { language: 'python' });
4950
```
5051

5152
## API
@@ -61,11 +62,15 @@ Transform markdown to an ES module string.
6162

6263
### `highlight(code, options?)`
6364

64-
Highlight code with syntax highlighting.
65+
Highlight code with syntax highlighting using Shiki.
6566

66-
### `registerLanguage(name)`
67+
**Options:**
68+
- `language` - Programming language (e.g., 'javascript', 'python')
69+
- `theme` - Shiki theme (default: 'github-light')
70+
71+
### `initHighlighter()`
6772

68-
Register a language for highlighting.
73+
Initialize the Shiki highlighter. Called automatically on first use.
6974

7075
## License
7176

packages/react-code-view/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- `useCodeExecution` effect behavior stabilized; consumers relying on previous implicit re-execution may need to explicitly update `code` or pass `dependencies`
1717
- Package structure reorganized across `packages/*`; import paths may need updates according to exports
1818
- Imports: `CodeView` is now also a default export in `@react-code-view/react` and re-exported by `react-code-view`; prefer `import CodeView from 'react-code-view'` or adjust named imports accordingly
19-
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'` and optional `import 'react-code-view/styles/highlight'`
19+
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'`
2020
- Build integration: Legacy `webpack-md-loader` is removed; migrate to unified `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack
2121
- Tooling: Minimum requirements updated to Node >=18 and PNPM >=8 for the monorepo/dev workflow
2222

packages/react-code-view/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,8 @@ Import the base styles:
145145

146146
```tsx
147147
import 'react-code-view/styles';
148-
// or specific files
148+
// or
149149
import 'react-code-view/styles/index.css';
150-
import 'react-code-view/styles/highlight.css';
151150
```
152151

153152
Use theme classes:

packages/react/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- `useCodeExecution` effect behavior stabilized; consumers relying on previous implicit re-execution may need to explicitly update `code` or pass `dependencies`
1717
- Package structure reorganized across `packages/*`; import paths may need updates according to exports
1818
- Imports: `CodeView` is now also a default export in `@react-code-view/react` and re-exported by `react-code-view`; prefer `import CodeView from 'react-code-view'` or adjust named imports accordingly
19-
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'` and optional `import 'react-code-view/styles/highlight'`
19+
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'`
2020
- Build integration: Legacy `webpack-md-loader` is removed; migrate to unified `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack
2121
- Tooling: Minimum requirements updated to Node >=18 and PNPM >=8 for the monorepo/dev workflow
2222

packages/unplugin/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- `useCodeExecution` effect behavior stabilized; consumers relying on previous implicit re-execution may need to explicitly update `code` or pass `dependencies`
1717
- Package structure reorganized across `packages/*`; import paths may need updates according to exports
1818
- Imports: `CodeView` is now also a default export in `@react-code-view/react` and re-exported by `react-code-view`; prefer `import CodeView from 'react-code-view'` or adjust named imports accordingly
19-
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'` and optional `import 'react-code-view/styles/highlight'`
19+
- Styles: Less entries were removed; switch to `import 'react-code-view/styles'`
2020
- Build integration: Legacy `webpack-md-loader` is removed; migrate to unified `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack
2121
- Tooling: Minimum requirements updated to Node >=18 and PNPM >=8 for the monorepo/dev workflow
2222

0 commit comments

Comments
 (0)