npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-monaco-markdown

v1.0.13

Published

this is react-monaco-markdown Component

Downloads

962

Readme

react-monaco-markdown

NPM version NPM downloads

安装

npm

npm i react-monaco-markdown

pnpm

pnpm i react-monaco-markdown

yarn

yarn add react-monaco-markdown

使用

import ReactMonacoMarkdown from 'react-monaco-markdown';

<ReactMonacoMarkdown
  value={'**Hello react-monaco-markdown!!!**'}
  onChange={(pre) => changeData(pre.text)}
/>;

Options

| 参数 | 说明 | 类型 | 默认值 | 是否必填 | 版本 | | ---------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- | -------- | | className | 类 | string | - | false | >= 1.0.6 | | style | style 样式 | React.CSSProperties | - | false | >= 1.0.6 | | value | 属性值 | string | - | false | | | onChange | 修改数据方法 | (pre: ReturnValue) => void | - | false | | | renderHtml | 渲染 html 方法 | (pre: ReturnValue) => React.ReactNode | - | false | | | config | 额外配置 | EditorConfig | - | false | >= 1.0.6 | | width | 宽度 | number/string | 100% | false | >= 1.0.7 | | height | 高度 | number/string | 100% | false | >= 1.0.7 | | options | monaco-editor 的 options 配置 | editor.IStandaloneEditorConstructionOptions | - | false | >= 1.0.7 |

EditorConfig

| 参数 | 说明 | 类型 | 默认值 | 是否必填 | 版本 | | ------------------- | -------------- | ------------------------------------------------------- | ------- | -------- | -------- | | theme | 主题 | 'light' / 'dark' | 'light' | false | >= 1.0.7 | | isReadOnly | 是否只读 | Boolean | false | false | >= 1.0.7 | | view | 切换展示视图 | View | - | false | >= 1.0.7 | | htmlClass | 展示区域 class | string | - | false | >= 1.0.7 | | markdownClass | 编写区域 class | string | - | false | >= 1.0.7 | | table | 表格配置 | Table | - | false | >= 1.0.7 | | imageUrl | 预设 图片 URL | string | - | false | >= 1.0.7 | | imageAccept | 图片 accept | string | - | false | >= 1.0.7 | | linkUrl | 预设 link Url | string | - | false | >= 1.0.7 | | onCustomImageUpload | 自定义图片上传 | (event: any) => Promise<{ url: string; text?: string }> | - | false | >= 1.0.7 | | onImageUpload | 本地图片上传 | UploadFunc | - | false | >= 1.0.7 |

Table

export interface Table {
  maxRow: number;
  maxCol: number;
}

View

export interface View {
  menu?: boolean;
  both?: boolean;
  md?: boolean;
  html?: boolean;
}

UploadFunc

export type UploadFunc =
  | ((file: File) => Promise<string>)
  | ((file: File, callback: (url: string) => void) => void);

在 Next.js 中使用

import dynamic from 'next/dynamic'
const ReactMonacoMarkdown = dynamic(() => import('react-monaco-markdown'), {ssr: false})

const NextMarkdownPreview = dynamic(() => import('react-monaco-markdown').then(res => res.NextMarkdownPreview), {ssr: false})

<ReactMonacoMarkdown
  value={'**Hello react-monaco-markdown!!!**'} />
  onChange={pre => changeData(pre.text)}
  renderHtml={pre => <NextMarkdownPreview code={pre.text} />}
/>

LICENSE

MIT