@uiw/react-md-editor 4.0.0 → 4.0.1

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.
Files changed (2) hide show
  1. package/README.md +12 -14
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -6,6 +6,9 @@
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
+ <a href="https://jaywcjlove.github.io/#/sponsor" target="__blank">
10
+ <img alt="Buy me a coffee" src="https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee">
11
+ </a>
9
12
  <a href="https://www.npmjs.com/package/@uiw/react-md-editor" target="__blank">
10
13
  <img alt="Downloads" src="https://img.shields.io/npm/dm/@uiw/react-md-editor.svg?style=flat">
11
14
  </a>
@@ -594,18 +597,14 @@ export default function App() {
594
597
  onChange={(val) => setValue(val)}
595
598
  previewOptions={{
596
599
  components: {
597
- code: ({ inline, children = [], className, ...props }) => {
598
- const txt = children[0] || '';
599
- if (inline) {
600
- if (typeof txt === 'string' && /^\$\$(.*)\$\$/.test(txt)) {
601
- const html = katex.renderToString(txt.replace(/^\$\$(.*)\$\$/, '$1'), {
602
- throwOnError: false,
603
- });
604
- return <code dangerouslySetInnerHTML={{ __html: html }} />;
605
- }
606
- return <code>{txt}</code>;
600
+ code: ({ children = [], className, ...props }) => {
601
+ if (typeof children === 'string' && /^\$\$(.*)\$\$/.test(children)) {
602
+ const html = katex.renderToString(children.replace(/^\$\$(.*)\$\$/, '$1'), {
603
+ throwOnError: false,
604
+ });
605
+ return <code dangerouslySetInnerHTML={{ __html: html }} style={{ background: 'transparent' }} />;
607
606
  }
608
- const code = props.node && props.node.children ? getCodeString(props.node.children) : txt;
607
+ const code = props.node && props.node.children ? getCodeString(props.node.children) : children;
609
608
  if (
610
609
  typeof code === 'string' &&
611
610
  typeof className === 'string' &&
@@ -729,7 +728,6 @@ const Code = ({ inline, children = [], className, ...props }) => {
729
728
  mermaid
730
729
  .render(demoid.current, code)
731
730
  .then(({ svg, bindFunctions }) => {
732
- console.log("svg:", svg);
733
731
  container.innerHTML = svg;
734
732
  if (bindFunctions) {
735
733
  bindFunctions(container);
@@ -945,8 +943,8 @@ As always, thanks to our amazing contributors!
945
943
  <a href="https://github.com/MercierCorentin" title="Corentin Mercier">
946
944
  <img src="https://avatars.githubusercontent.com/u/46066895?v=4" width="42;" alt="Corentin Mercier"/>
947
945
  </a>
948
- <a href="https://github.com/dmitriyyan" title="Dmitriy Yanushkevich">
949
- <img src="https://avatars.githubusercontent.com/u/89025862?v=4" width="42;" alt="Dmitriy Yanushkevich"/>
946
+ <a href="https://github.com/dmitriyyan" title="Dmitrii Ianushkevich">
947
+ <img src="https://avatars.githubusercontent.com/u/89025862?v=4" width="42;" alt="Dmitrii Ianushkevich"/>
950
948
  </a>
951
949
  <a href="https://github.com/jnishiyama" title="James Finucane">
952
950
  <img src="https://avatars.githubusercontent.com/u/2048195?v=4" width="42;" alt="James Finucane"/>
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@uiw/react-md-editor",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "A markdown editor with preview, implemented with React.js and TypeScript.",
5
5
  "homepage": "https://uiwjs.github.io/react-md-editor/",
6
+ "funding": "https://jaywcjlove.github.io/#/sponsor",
6
7
  "author": "kenny wang <wowohoo@qq.com>",
7
8
  "main": "lib/index.js",
8
9
  "module": "esm/index.js",