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

vulcan-markdown-editor-cli

v1.1.8

Published

基于react-codemirror2打造的markdown在线编辑器

Downloads

26

Readme

一个基于 react-codemirror2 打造的 markdown 在线编辑器

1、描述

目前已经存在很多在线的 markdown 编辑器,本着不重复造轮子的想法,奈何没有找到适合我的,(重度强迫症患者..) 于是就想想自己实现一个编辑器。当前的版本主要还是满足自己的需求,不太支持太多定制化的功能。 后续有空的话,可以考虑重新封装。

初始版本,目前支持的功能:

  • 图片上传(上传本地图片、复制粘贴上传)
  • 实时预览
  • 代码高亮风格
  • 编辑器主题
  • 文档主题
  • markdown 文档本地导入

用法

1.安装

npm i --save vulcan-markdown-editor-cli/lib

2. 编辑器 demo

在线 demo

import React from 'react';
import { MDEditor } from 'vulcan-markdown-editor-cli/lib';
import 'vulcan-markdown-editor-cli/lib/main.min.css';

export default () => {
    // 图片上传配置项
    const imageUploadConf = {
        url: apiPath.attachments,
        headers: { Authorization: `Bearer ${getToken('access')}` }
    };

    const initValue = '# 这是一个基于react-codemirror2打造的markdown在线编辑器';

    return (
        <MDEditor
            imageUploadConf={imageUploadConf}
            initValue={initValue}
            height={'100%'}
            onChange={value => {
                console.log(value);
            }}
        />
    );
};

3. markdown 转 html 组件 demo

import React from 'react';
import { MDPriview } from 'vulcan-markdown-editor-cli/lib';
import 'vulcan-markdown-editor-cli/lib/main.min.css';

export default () => {
    // markdown内容
    const value = '# 这是一个基于react-codemirror2打造的markdown在线编辑器';

    // 文章内容主题
    const contentTheme = 'awesome-green';

    // 代码高亮风格
    // 目前内置(a11yDark、prism、synthwave84、tomorrow)
    const codeHigTheme = 'a11yDark';

    return <MDPriview value={value} contentTheme="awesome-green" codeHigTheme={codeHigTheme} />;
};

目前该组件内置四种主题:

  • awesome-green
  • juejin
  • smartblue
  • channing-cyan

上述主题均来自社区优秀的主题地址,再次特别鸣谢这些主题的作者,若有侵权,请联系作者删除!