-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc52578
commit aa3b0d1
Showing
10 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { LoaderConfOptions, WebpackConfiguration } from 'kkt'; | ||
|
||
export default (conf: WebpackConfiguration, env: 'production' | 'development', options: LoaderConfOptions) => { | ||
conf.ignoreWarnings = [{ module: /node_modules[\\/]parse5[\\/]/ }]; | ||
// https://github.com/kktjs/kkt/issues/336#issue-1097660932 | ||
conf.module!.exprContextCritical = false; | ||
if (env === 'production') { | ||
conf.output = { ...conf.output, publicPath: './' }; | ||
} | ||
return conf; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@examples/269", | ||
"version": "5.1.1", | ||
"private": true, | ||
"scripts": { | ||
"build": "kkt build", | ||
"start": "kkt start" | ||
}, | ||
"dependencies": { | ||
"react": "~18.2.0", | ||
"react-dom": "~18.2.0", | ||
"rehype-sanitize": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@kkt/less-modules": "^7.4.7", | ||
"@kkt/scope-plugin-options": "^7.4.7", | ||
"kkt": "^7.4.7" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>React Markdown Preview</title> | ||
<meta name="keywords" content="react,component,markdown,preview" /> | ||
<meta name="description" content="React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub Markdown style." /> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize'; | ||
import MarkdownPreview from '@uiw/react-markdown-preview'; | ||
|
||
const source = ` | ||
## MarkdownPreview | ||
\`\`\`bash | ||
$ npm install @uiw/react-markdown-preview --save | ||
\`\`\` | ||
`; | ||
|
||
export default function Demo() { | ||
return ( | ||
<MarkdownPreview | ||
source={source} | ||
rehypePlugins={[ | ||
[ | ||
rehypeSanitize, | ||
{ | ||
...defaultSchema, | ||
attributes: { | ||
...defaultSchema.attributes, | ||
svg: ['className', 'hidden', 'viewBox', 'fill', 'height', 'width'], | ||
path: ['fill-rule', 'd'], | ||
div: ['className', 'class', 'data-code', ...(defaultSchema.attributes?.div || [])], | ||
}, | ||
tagNames: [...(defaultSchema.tagNames || []), 'svg', 'path', 'div'], | ||
}, | ||
], | ||
]} | ||
style={{ padding: 16 }} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createRoot } from 'react-dom/client'; | ||
import Demo from './example'; | ||
|
||
const container = document.getElementById('root'); | ||
const root = createRoot(container!); | ||
|
||
root.render(<Demo />); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="react-scripts" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig", | ||
"compilerOptions": { | ||
"baseUrl": "./" | ||
}, | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"version": "5.1.2", | ||
"packages": ["core", "website"] | ||
"packages": ["core", "examples/**", "website"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
"node": ">=16.0.0" | ||
}, | ||
"workspaces": [ | ||
"examples/**", | ||
"core", | ||
"website" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters