Giter Site home page Giter Site logo

doocs / md Goto Github PK

View Code? Open in Web Editor NEW
5.2K 59.0 823.0 159.32 MB

✍ WeChat Markdown Editor | 一款高度简洁的微信 Markdown 编辑器:支持 Markdown 语法、色盘取色、多图上传、一键下载文档、自定义 CSS 样式、一键重置等特性

Home Page: https://doocs.github.io/md/

License: Do What The F*ck You Want To Public License

JavaScript 43.43% HTML 1.43% Vue 49.94% Less 5.16% Shell 0.04%
wechat articles markdown editor markdown-editor javascript github-pages gitee-pages vue doocs

md's Introduction

doocs-md

微信 Markdown 编辑器

sync status deploy status prettier status users PRs Welcome
github gitee gitee license release

项目介绍

本项目基于 wechat-format 进行二次开发,感谢 lyricat 的创意和贡献!

Markdown 文档自动即时渲染为微信图文,让你不再为微信文章排版而发愁!只要你会基本的 Markdown 语法,就能做出一篇样式简洁而又美观大方的微信图文。

在线编辑器地址

https://doocs.github.io/md

注:推荐使用 Chrome 浏览器,效果最佳。

为何二次开发

现有的开源微信 Markdown 编辑器,样式繁杂,也不符合我个人的审美需求。在我使用它们进行文章排版的时候,经常还要自己做一些改动,费时费力,因此动手做了二次开发。

欢迎各位朋友随时提交 PR,让这款微信 Markdown 编辑器变得更好!如果你有新的想法,也欢迎在 Discussions 讨论区反馈。

功能特性

  • 支持自定义 CSS 样式
  • 支持 Markdown 所有基础语法
  • 支持浅色、暗黑两种主题模式
  • 支持 Ctrl + F 快速格式化文档
  • 支持色盘取色,快速替换文章整体色调
  • 支持多图上传,可自定义配置图床
  • 支持自定义上传逻辑
  • 支持在编辑框右键弹出功能选项卡
  • 支持批量转换本地图片为线上图片

目前支持哪些图床

# 图床 使用时是否需要配置 备注
1 默认 -
2 GitHub 配置 RepoToken 参数 如何获取 GitHub token?
3 阿里云 配置 AccessKey IDAccessKey SecretBucketRegion 参数 如何使用阿里云 OSS?
4 腾讯云 配置 SecretIdSecretKeyBucketRegion 参数 如何使用腾讯云 COS?
5 七牛云 配置 AccessKeySecretKeyBucketDomainRegion 参数 如何使用七牛云 Kodo?
6 MinIO 配置 EndpointPortUseSSLBucketAccessKeySecretKey 参数 如何使用 MinIO?
7 自定义上传 如何自定义上传?

select-and-change-color-theme

copy-and-paste

custom

doocs-md-upload-image

注意事项

  1. 如果你使用了某些浏览器脚本修改了网页背景色,可能导致渲染后的文章出现背景色分块的现象,详见 #63
  2. 某些浏览器插件,会对文章样式造成破坏。现象是:复制粘贴到公众号后台文章,点击保存时,样式丢失,详见 #151

自定义上传逻辑

在工具上没有提供预定义图床的情况下,你只需要自定义上传逻辑即可,这对于例如你不方便使用公共图床,而是使用自己的上传服务时非常有用。

你只需要在给定的函数中更改上传代码即可,为了方便,这个函数提供了可能使用的一些参数:

示例代码:

const { file, util, okCb, errCb } = CUSTOM_ARG;
const param = new FormData();
param.append("file", file);
util.axios
  .post("http://127.0.0.1:9000/upload", param, {
    headers: { "Content-Type": "multipart/form-data" },
  })
  .then((res) => {
    okCb(res.url);
  })
  .catch((err) => {
    errCb(err);
  });

// 提供的可用参数:
// CUSTOM_ARG = {
//   content, // 待上传图片的 base64
//   file, // 待上传图片的 file 对象
//   util: {
//     axios, // axios 实例
//     CryptoJS, // 加密库
//     OSS, // ali-oss
//     COS, // cos-js-sdk-v5
//     Buffer, // buffer-from
//     uuidv4, // uuid
//     qiniu, // qiniu-js
//     tokenTools, // 一些编码转换函数
//     getDir, // 获取 年/月/日 形式的目录
//     getDateFilename, // 根据文件名获取它以 时间戳+uuid 的形式
//   },
//   okCb: resolve, // 重要!上传成功后给此回调传 url 即可
//   errCb: reject, // 上传失败调用的函数
// }

如果你创建了适用于其他第三方图床的上传代码,我们非常欢迎你分享它。

如何开发和部署

# 安装依赖
npm i

# 启动开发模式
npm start

# 部署在 /md 目录
npm run build
# 访问 http://127.0.0.1:9000/md

# 部署在根目录
npm run build:h5-netlify
# 访问 http://127.0.0.1:9000/

快速搭建私有服务

方式 1. 使用 npm cli

通过我们的 npm cli 你可以轻易搭建属于自己的微信 Markdown 编辑器。

# 安装
npm i -g @doocs/md-cli

# 启动
md-cli

# 访问
open http://127.0.0.1:8800/md/

# 启动并指定端口
md-cli port=8899

# 访问
open http://127.0.0.1:8899/md/

md-cli 支持以下命令行参数:

  • port 指定端口号,默认 8800,如果被占用会随机使用一个新端口。
  • spaceId dcloud 服务空间配置
  • clientSecret dcloud 服务空间配置

方式 2. 使用 Docker 镜像

如果你是 Docker 用户,也可以直接使用一条命令,启动完全属于你的、私有化运行的实例。

docker run -d -p 8080:80 doocs/md:latest

容器运行起来之后,打开浏览器,访问 http://localhost:8080 即可。

关于本项目 Docker 镜像的更多详细信息,可以关注 https://github.com/doocs/docker-md

谁在使用

注:如果你使用了本 Markdown 编辑器进行文章排版,并且希望在本项目 README 中展示你的公众号,请到 #5 留言。

md's People

Contributors

arunsathiya avatar bravekingzhang avatar dandelioncloud avatar dependabot[bot] avatar dislazy avatar fossabot avatar hlwlh avatar imgbotapp avatar jimqing avatar li-xunhuan avatar miaogaolin avatar monkeywithacupcake avatar ocian avatar soulteary avatar thinkasany avatar wll8 avatar yangfong avatar yanglbme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

md's Issues

建议

  1. 能否让

这个
字体改成浅灰色,希望默认就这样,哈哈,并且引用的字体能比正文字体小1.5px

  1. 代码高亮希望继续支持
    version Docker Automated Build AWVS14_Update
    能否把这种做成文字效果,原本是图片,边框圆润滑,应该用<span>还是

图片上传报错

1345
作者您好,发现在使用过程中,使用默认图床上传图片,会出现错误。图片是上传成功的,但是并没有把上传后的链接填充到编辑区域。

lost code block‘s style

Hi there,

There is a bug that web ide can not render the code block's style.

Thanks and happy new year ☕

导出HTML异常

### Updates by Docker

- Automatic deployment using Github Action

## Use

\```bash
docker run -it -d \
--name awvs \
-p 3443:3443 \
--restart=always \
xrsec/awvs:latest
\```
### Updates by Docker
### Updates by Docker
### Updates by Docker

导出html 换行异常

keybase.me

Keybase proof

I hereby claim:

  • I am gijstm on github.
  • I am gijstm (https://keybase.io/gijstm) on keybase.
  • I have a public key ASB5YLIbyyf2h9ODhP9hv-k6OZD_Q0Ht9uDVmYN72OSKBgo

To claim this, I am signing this object:

{
  "body": {
    "key": {
      "eldest_kid": "01207960b21bcb27f687d38384ff61bfe93a3990ff4341edf6e0d599837bd8e48a060a",
      "host": "keybase.io",
      "kid": "01207960b21bcb27f687d38384ff61bfe93a3990ff4341edf6e0d599837bd8e48a060a",
      "uid": "c0ad7d221348f8a444907c0669c48519",
      "username": "gijstm"
    },
    "merkle_root": {
      "ctime": 1612859669,
      "hash": "675269925c96579fc71548e119802a26abd92a3a812ebac8077f7daf0e3159d11807d959901b1f8acc2da9a2e515a92ad245e7f68774d4a255f841abac333fac",
      "hash_meta": "38548b1547337bf988cae7aac254d4894062cc14bb2693b97dade919e66e6468",
      "seqno": 19055943
    },
    "service": {
      "entropy": "R90nGwJ1DifRsYDbbOIJBotd",
      "name": "github",
      "username": "gijstm"
    },
    "type": "web_service_binding",
    "version": 2
  },
  "client": {
    "name": "keybase.io go client",
    "version": "5.6.0"
  },
  "ctime": 1612859682,
  "expire_in": 504576000,
  "prev": "d6d606d021b46c9db25c87f29a0f1c324a57e3773df0b0c60cd9aa4854051c2f",
  "seqno": 6,
  "tag": "signature"
}

with the key ASB5YLIbyyf2h9ODhP9hv-k6OZD_Q0Ht9uDVmYN72OSKBgo, yielding the signature:

hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgeWCyG8sn9ofTg4T/Yb/pOjmQ/0NB7fbg1ZmDe9jkigYKp3BheWxvYWTESpcCBsQg1tYG0CG0bJ2yXIfymg8cMkpX43c98LDGDNmqSFQFHC/EIM22rMaO59xntfi6M4q/EBCehudDmdWhpNFFCD5/KOHdAgHCo3NpZ8RAj55ru2VDF9oEXWZQEZX1CDbf+gVH9HgKoPGZDc/xbgU1U1SYdfWi4DZhj0SwYme/WJ1xQrzYl9U/XmvR+463BKhzaWdfdHlwZSCkaGFzaIKkdHlwZQildmFsdWXEIKiGnw4ubQRmX2uEWQPsGuZMmIbSZVBopfcajLNGgxA9o3RhZ80CAqd2ZXJzaW9uAQ==

And finally, I am proving ownership of the github account by posting this as a gist.

My publicly-auditable identity:

https://keybase.io/gijstm

From the command line:

Consider the keybase command line program.

# look me up
keybase id gijstm

编辑器外观重构

编辑器可能要在外观上做调整,将顶部菜单栏调整为软件菜单栏的形式,大致分为:

文件 格式 编辑 样式 帮助
导入 .md
导出 .md
导出 .html
设置偏好(黑夜模式等)
加粗
斜体
删除线
超链接
格式化
微信外链转底部引用
重置
插入图片
插入表格
字体
字号
主题色
自定义 CSS
关于

有没有同学有兴趣做的?或者有没有其他更好的设计实现方案,欢迎交流

VERY IMPRESSIVE!

VERY IMPRESSIVE and this is the ONLY one i could use in success.
i have one question: do you plan to support LaTex in markdown?

重置建议

我建议取消内容重置。

这就好比很多工具中,你设置了很多东西,最后又想重新设置,就可以恢复默认设置。

能否做成npm包发布

现在想在项目里引入这个,太麻烦了,还得扣代码,也不利于后期的升级与维护。

添加css时网页卡死

作者你好~ 我发现在添加CSS样式的时候页面会卡死(Chrome&Edge),在现有的CSS上编辑没有问题。比如在末尾添加:

div {
  margin-top: 10em;
}

而且,复制粘贴没有问题,直接输入就会卡死。

问题:无序列表如何自定义样式?

目前我们自定义了一套 CSS 样式,包括引用、正文、标题等都可以生效,但无序列表无法自定义样式,我尝试过的设置有:

ul, ol {
  padding-left: 15px;
}

li {
  margin: 10px;
}

li p {
  margin: 10px 0 !important;
}

ul ul, ul ol, ol ul, ol ol {
  margin: 0;
  padding-left: 10px;
}

ul {
  list-style: square;
}

dl {
  padding: 0;
}

dl dt {
  font-size: 1em;
  font-weight: bold;
  font-style: italic;
}

dl dd {
  margin: 0 0 10px;
  padding: 0 10px;
}

如果单纯设置无序列表的样式比如自定义字体、缩进,有特殊的标记格式嘛?

调整代码字体大小

请问如何在定制 css 时调整代码字体大小,没有提供相关示例。 在公众号中如果代码字体太大,看起来不方便。

请求 Github Pages 的 CNAME支持

看到该项目提交代码后会通过Github Action部署到Github Pages.

可以使用 {user}.github.io/md域名去访问.

如果在gh-pages手动添加CNAME文件,由于Github部署时候带了子目录md,而CNAME是在根目录,会导致全部文件404.

并且,每次提交都会重新部署一次,似乎会导致gh-pages分支的CNAME文件丢失.

能否添加完善的CNAME支持,可以使用自定义域名访问,感谢.

How to get in touch regarding a security concern

Hey there!

I belong to an open source security research community, and a member (@ning1022) has found an issue, but doesn’t know the best way to disclose it.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

图片上传失败

请问github搭建的图床粘贴时会报:图片上传失败。示例中的可以正常粘贴。为什么?

有没有想法支持minio啊?

RT. 我下载代码想Pr,但是跑不起来,提示下面这个错误

> [email protected] start
> run-p serve mm


> [email protected] serve
> vue-cli-service serve


> [email protected] mm
> npx mockm --cwd=mm

 INFO  Starting development server...
 ERROR  Error: Cannot find module './buble.js'
Require stack:
- E:\Projects\OpenSource\md\node_modules\vue-template-es2015-compiler\index.js
- E:\Projects\OpenSource\md\node_modules\@vue\component-compiler-utils\dist\compileTemplate.js
- E:\Projects\OpenSource\md\node_modules\@vue\component-compiler-utils\dist\index.js
- E:\Projects\OpenSource\md\node_modules\vue-loader\lib\index.js
- E:\Projects\OpenSource\md\node_modules\@vue\cli-service\lib\config\base.js
- E:\Projects\OpenSource\md\node_modules\@vue\cli-service\lib\Service.js
- E:\Projects\OpenSource\md\node_modules\@vue\cli-service\bin\vue-cli-service.js
Error: Cannot find module './buble.js'
Require stack:
- E:\Projects\OpenSource\md\node_modules\vue-template-es2015-compiler\index.js
- E:\Projects\OpenSource\md\node_modules\@vue\component-compiler-utils\dist\compileTemplate.js
- E:\Projects\OpenSource\md\node_modules\@vue\component-compiler-utils\dist\index.js
- E:\Projects\OpenSource\md\node_modules\vue-loader\lib\index.js
- E:\Projects\OpenSource\md\node_modules\@vue\cli-service\lib\config\base.js
- E:\Projects\OpenSource\md\node_modules\@vue\cli-service\lib\Service.js
- E:\Projects\OpenSource\md\node_modules\@vue\cli-service\bin\vue-cli-service.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (E:\Projects\OpenSource\md\node_modules\vue-template-es2015-compiler\index.js:1:13)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (E:\Projects\OpenSource\md\node_modules\@vue\component-compiler-utils\dist\compileTemplate.js:10:19)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
                      _              
>> mockm v1.1.25     | |
 _ __ ___   ___   ___| | ___ __ ___
| '_ ` _ \ / _ \ / __| |/ / '_ ` _ \
| | | | | | (_) | (__|   <| | | | | |
|_| |_| |_|\___/ \___|_|\_\_| |_| |_|

ERROR: "serve" exited with 1.

Process finished with exit code 1

斜体显示

我注意到本项目(我pull了最新的代码在本地也测试过)使用*斜体*显示会导致换行,不知道是否故意这么设计的?

md

另外,我最近才发现使用这个项目,对会一些技术的人来说真的很友好!谢谢你的贡献!

本地启动失败

系统:macOS 12
node 版本: 14.15.5
使用了 nvm,错误截图如下:
image

裂墙需求便携式离线版~~~

单位电脑不能上网, 只能用离线的绿色版本...超级喜欢这种自定义样式的模式, 能不能出一个单机的离线便携版呀, 我日常办公已经离不开Markdown了

外链 不能展示

在markdown中写的外链,在您平台上转化个时候,丢失了跳转的外链。有解决的办法吗?

样式丢失问题

Hi
我用 htmlcss 写了一个 Card,代码如下 👇

<div style="margin: auto; width:250px; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19); text-align: center; border-radius: 10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); box-shadow: 0 0 20px #a812ff;">
   <img style="width:20%; height:20%;" src="https://gitee.com/jeremywuiot/img-res-all/raw/master/src/iie_shop/tack_purple_128x128.png"/>
   <img src="https://gitee.com/jeremywuiot/img-res-all/raw/master/src/iie_shop/wechat_qr_code_2021_02.png" style="width:100%"/>
      <img style="width:15%; height:15%; position: relative; top: 0px;left: 0px;" src="https://gitee.com/jeremywuiot/img-res-all/raw/master/src/iie_shop/tada.gif" />
      <div style="padding: 1px;">
         <p style="font-size:12px; color: #a812ff">长按关注公众号 ⌈全栈民工⌋ 🎉</p>
         <p style="font-size:12px; color: #a812ff">原创技术文章第一时间推送 🙌</p>
      </div>
</div>

md 中显示正常,如下 👇
image

但是复制到公众号编辑器里,显示就比较奇怪了,看起来样式丢失了 🐛
image

环境如下:

  • OS - Windows 11 Professional 21H2
  • Browser - Microsoft Edge 96.0.1054.62

Thanks ☕

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.