微信公众号排版工具-markdown here使用教程

微信公众号排版样式,使用浏览器插件Markdown Here,将markdown内容进行样式排版为微信公众号文章

1. 插件安装

谷歌/Edge/火狐浏览器安装插件:Markdown Here

2. 打开插件

点击图标->选项:会出现Markdown here 的页面;

3. 使用方式

  1. 在页面的预览区域内,书写markdown内容;
  2. 点击markdown转换后,变为微信公众号支持的样式,全选复制到微信公众号即可;

页面中的基本渲染CSS,语法高亮CSS用于控制markdown转换的样式;

4. 插件配置

推荐一个好用的样式,如下

4.1. 基本渲染CSS

.markdown-here-wrapper {
}
 
/* To add site specific rules, you can use the `data-md-url` attribute that we
   add to the wrapper element. Note that rules like this are used depending
   on the URL you're *sending* from, not the URL where the recipient views it.
*/
/* .markdown-here-wrapper[data-md-url*="mail.yahoo."] ul { color: red; } */
 
 
/* In edit mode, Wordpress uses a `* { font: ...;} rule+style that makes highlighted
code look non-monospace. This rule will override it. */
.markdown-here-wrapper[data-md-url*="wordpress."] code span {
  font: inherit;
}
 
/* Wordpress adds a grey background to `pre` elements that doesn't go well with
our syntax highlighting. */
.markdown-here-wrapper[data-md-url*="wordpress."] pre {
  background-color: transparent;
}
 
/* This spacing has been tweaked to closely match Gmail+Chrome "paragraph" (two line breaks) spacing.
Note that we only use a top margin and not a bottom margin -- this prevents the
"blank line" look at the top of the email (issue #243).
*/
 
p {
  /* !important is needed here because Hotmail/Outlook.com uses !important to
     kill the margin in <p>. We need this to win. */
  margin: 0 0 1.5em 0 !important;
  font-size: 15px;
}
 
pre {
  padding: 10px;
  line-height: 1em;
  box-sizing: border-box; 
  background-color: #F8F8F8;
  margin: 0px 0px 1.5em !important;
  color: #333;
  word-wrap: break-word!important;
  overflow: auto;
}
 
pre code {
  line-height: 1.75em;
    white-space: pre;
    box-sizing: border-box; 
    font-size: 14px;
    font-family: monospace;
    background: none;
 
};
 
 
table, dl, blockquote, q, ul, ol {
  margin: 1.2em 0;
}
 
ul, ol {
  padding-left: 2em;
  font-size: 15px;
  padding-bottom: 1em;
}
 
li {
  margin: 0.5em 0;
   font-size: 15px;
}
li code{
  font-size: 15px;
  line-height: 1.75em;
  font-family: monospace; 
  color: rgb(199, 37, 78);
  background-color: rgb(249, 242, 244);
  padding: 3px 5px;
  max-width: 100% !important;
}
 
/* Space paragraphs in a list the same as the list itself. */
li p {
  /* Needs !important to override rule above. */
  margin: 0.5em 0 !important; 
}/* Smaller spacing for sub-lists */
ul ul, ul ol, ol ul, ol ol {
  margin: 0;
  padding-left: 1em;
}
 
/* Use Roman numerals for sub-ordered-lists. (Like Github.) */
ol ol, ul ol {
  list-style-type: lower-roman;
}
 
/* Use letters for sub-sub-ordered lists. (Like Github.) */
ul ul ol, ul ol ol, ol ul ol, ol ol ol {
  list-style-type: lower-alpha;
}
 
p code {
    font-size:15px;
    line-height: 1.75em;
    max-width: 100%!important;
    font-family: monospace;
    color: #c7254e;
    background-color: #f9f2f4;
    padding-left:5px;
    padding-right:5px;
    padding-top:3px;
    padding-bottom:3px;
};
 
dl {
  padding: 0;
}
 
dl dt {
  font-size: 15px;
  font-weight: bold;
  font-style: italic;
}
 
dl dd {
  margin: 0 0 1em;
  padding: 0 1em;
}
 
blockquote, q {
  border-left: 2px solid #009a61;
  background: #f6f6f6;
  color: #555;
  quotes: none;
  line-height: 1.6;
  word-wrap: break-word;
    padding-bottom:1px;
    padding-top:20px;
    margin: 1.5em 0;
 
 
}
 
 
 
h1, h2, h3, h4, h5, h6 {
  margin: 1.3em 0 1em;
  padding: 0;
  font-weight: bold;
 
}
 
h1 {
  font-size: 20px;
  border-bottom: 1px solid #ddd;
}
 
h2 {
  font-size: 20px;
  border-bottom: 1px solid #eee;
}
 
h3 {
  font-size: 18px;
}
 
h4 {
  font-size: 16px;
}
 
h5 {
  font-size: 16px;
}
 
h6 {
  font-size: 16px;
  color: #777;
}
 
table {
  padding: 0;
  border-collapse: collapse;
  border-spacing: 0;
  font-size:15px ;
  font: inherit;
  border: 0;
}
 
tbody {
  margin: 0;
  padding: 0;
  border: 0;
}
 
table tr {
  border: 0;
  border-top: 1px solid #CCC;
  background-color: white;
  margin: 0;
  padding: 0;
}
 
 
table tr th, table tr td {
  font-size: 15px;
  border: 1px solid #CCC;
  margin: 0;
  padding: 0.5em 1em;
}
 
table tr th {
 font-weight: bold;
  background-color: #F0F0F0;
}

4.2. 语法高亮CSS

/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
 
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  color: #657b83;
  -webkit-text-size-adjust: none;
}
 
.hljs-comment,
.hljs-template_comment,
.hljs-pi,
.hljs-doctype,
.diff .hljs-header,
.hljs-javadoc {
  color: #93a1a1;
  font-style: italic;
}
 
 
.hljs-keyword,
.hljs-addition,
.method,
.css .rule .hljs-keyword,
.hljs-winutils,
.javascript .hljs-title,
.nginx .hljs-title,
.hljs-subst,
.hljs-request,
.hljs-status {
  color: #859900;
  font-weight: bold;
}
 
 
.hljs-command,
.hljs-phpdoc,
.hljs-tag,
.hljs-number,
.hljs-regexp,
.hljs-string,
.hljs-hexcolor,
.hljs-tag .hljs-value,
.hljs-rules .hljs-value,
.tex .hljs-formula,
.hljs-link_url,
.ruby .hljs-constant {
  color: #2aa198;
}
 
 
 
.hljs-dartdoc {
  color: #d14;
}
 
.hljs-literal{
   color: #657b83;
}
 
.hljs-title,
.hljs-localvars,
.hljs-identifier,
.hljs-chunk,
.hljs-id,
.hljs-decorator,
.hljs-built_in,
.vhdl .hljs-literal,
.css .hljs-function,
.scss .hljs-preprocessor {
  color: #268bd2;
  font-weight: bold;
}
 
.javascript .hljs-title,
.hljs-list .hljs-keyword,
.hljs-subst {
  font-weight: normal;
}
 
 
.tex .hljs-command {
  color: #458;
  font-weight: bold;
}
 
.hljs-tag .hljs-title,
.hljs-rules .hljs-property,
.django .hljs-tag .hljs-keyword {
  color: #000080;
  font-weight: normal;
}
 
.hljs-attribute,
.hljs-variable,
.hljs-constant,
.hljs-class .hljs-title,
.hljs-type,
.hljs-parent,
.haskell .hljs-type,
.hljs-link_reference,
.smalltalk .hljs-number,
.lisp .hljs-body {
  color: #b58900;
}
 
 
.hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.lisp .hljs-keyword,
.clojure .hljs-keyword,
.scheme .hljs-keyword,
.tex .hljs-special,
.hljs-prompt {
  color: #990073;
}
 
 
.hljs-preprocessor,
.hljs-pragma,
.hljs-shebang,
.hljs-cdata {
  color: #999;
  font-weight: bold;
}
 
.hljs-deletion {
  background: #fdd;
}
 
 
.diff .hljs-change {
  background: #0086b3;
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对不起,我之前的回答有误,`vue-markdown-editor`并不支持粘贴图片的功能。但是,您可以使用`mavon-editor`来实现Vue 3中的Markdown编辑器,并支持粘贴图片。 以下是使用`mavon-editor`实现Markdown编辑器并支持粘贴图片的步骤: 1. 首先,使用npm或yarn安装`mavon-editor`: ```bash npm install mavon-editor ``` 2. 在您的Vue组件中,导入并注册`mavon-editor`: ```javascript import Vue from 'vue'; import mavonEditor from 'mavon-editor'; import 'mavon-editor/dist/css/index.css'; Vue.use(mavonEditor); ``` 3. 在模板中使用`mavon-editor`: ```html <template> <div> <mavon-editor v-model="markdownText" @imgAdd="handleImageUpload"></mavon-editor> </div> </template> ``` 4. 在Vue组件的`data`中定义`markdownText`,用于存储Markdown文本: ```javascript export default { data() { return { markdownText: '', }; }, }; ``` 5. 在Vue组件中定义处理图像上传的方法`handleImageUpload`: ```javascript export default { methods: { handleImageUpload(file, callback) { // 在这里处理图像上传逻辑 // 可以使用第三方库或自己实现图像上传功能 // 并返回图像URL,然后通过回调函数将其插入到Markdown文本中 // 示例代码: const imgUrl = 'http://example.com/image.png'; callback(imgUrl); }, }, }; ``` 通过以上步骤,您可以在Vue 3中使用`mavon-editor`实现Markdown编辑器,并支持粘贴图片的功能。请注意,您可能需要根据您的项目需求进行进一步的配置和样式调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值