阿禅 Jason Ng 大神对排版的思考3值得好好读几遍,它是对于内容呈现、阅读的深刻理解,推出的可能吧公众号排版器4,针对中文公众号的内容特征,做了一些额外的语法支持,写文章一气呵成,排版一键转换。如果文章图片和代码少,内容用 Markdown 书写,再粘贴到公众号后台,这个排版器是首选,很有逼格。排版器地址和具体的使用方法,前往 https://knb.im/mp/ 直接查看。
Markdown 插入图片
Markdown 插入图片5有三种方法,插图最基础的格式就是:,Alt text:图片的 Alt 标签,用来描述图片的关键词,可以不写,最初的本意是当图片因为某种原因不能被显示时而出现的替代文字,后来被用于SEO。图片链接可以是图片的本地地址或者是网址,”optional title”,鼠标悬置于图片上会出现的标题文字,可以不写。
$ hexo init padluo_blog $ cd padluo_blog $ hexo generate $ hexo server INFO Start processing INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
# Sidebar Avatar avatar: # Replace the default image and set the url here. url:/images/avatar.jpg # If true, the avatar will be dispalyed in circle. rounded:false # If true, the avatar will be rotated with the cursor. rotated:true
代码块到显示,把代码到颜色修改为黑色,并把复制按钮到样式修改为类似 Mac 的样式,修改 _config.yml 文件的 codeblock 区块,
1 2 3 4 5 6 7 8 9 10 11 12
codeblock: # Code Highlight theme # Available values: normal | night | night eighties | night blue | night bright | solarized | solarized dark | galactic # See: https://github.com/chriskempson/tomorrow-theme highlight_theme:nightbright # Add copy button on codeblock copy_button: enable:true # Show text copy result. show_result:true # Available values: default | flat | mac style:mac
# Reading progress bar reading_progress: enable:true # Available values: top | bottom position:top color:"#222" height:2px
bookmark
书签,可以根据阅读历史记录,在下次打开页面的时候帮助我们定位到上次的位置。
1 2 3 4 5 6 7 8
# Bookmark Support bookmark: enable:false # Customize the color of the bookmark. color:"#222" # If auto, save the reading progress when closing the page or clicking the bookmark-icon. # If manual, only save it by clicking the bookmark-icon. save:auto
github_banner
打开右上角的 GitHub 图标,点击之后可以跳转到其源码页面。
1 2 3 4 5
# `Follow me on GitHub` banner in the top-right corner. github_banner: enable:true permalink:https://github.com/padluo/padluo.github.io title:padluoGitHub
# Multiple Comment System Support comments: # Available values: tabs | buttons style:tabs # Choose a comment system to be displayed by default. # Available values: changyan | disqus | disqusjs | gitalk | livere | valine active:gitalk
然后找到 gitalk 配置,添加各项配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Gitalk # For more information: https://gitalk.github.io, https://github.com/gitalk/gitalk gitalk: enable:true github_id:padluo# GitHub repo owner repo:padluo.github.io# Repository name to store issues client_id:[client_id]# GitHub Application Client ID client_secret:[client_secret]# GitHub Application Client Secret admin_user:padluo# GitHub repo owner and collaborators, only these guys can initialize gitHub issues distraction_free_mode:true# Facebook-like distraction free mode # Gitalk's display language depends on user's browser or system environment # If you want everyone visiting your site to see a uniform language, you can set a force language value # Available values: en | es-ES | fr | ru | zh-CN | zh-TW language:zh-CN
# Math Formulas Render Support math: enable:true # Default (true) will load mathjax / katex script on demand. # That is it only render those page which has `mathjax: true` in Front-matter. # If you set it to false, it will load mathjax / katex srcipt EVERY PAGE. per_page:true
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support. mathjax: enable:true # See: https://mhchem.github.io/MathJax-mhchem/ mhchem:true
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support. katex: enable:false # See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex copy_tex:false
# Local search # Dependencies: https://github.com/wzpan/hexo-generator-search local_search: enable:true # If auto, trigger search by changing input. # If manual, trigger search by pressing enter key or search button. trigger:auto # Show top n results per article, show all results by setting to -1 top_n_per_article:5 # Unescape html strings to the readable one. unescape:false # Preload the search data when the page loads. preload:false
➜ /Users/padluo/Projects/Hexo/padluo_blog git:(blog-source) ✗ >git add _config.yml package-lock.json package.json source/404.md source/_posts/demo.md source/categories source/tags themes/next warning: 正在添加嵌入式 git 仓库:themes/next 提示:You've added another git repository inside your current repository. 提示:Clones of the outer repository will not contain the contents of 提示:the embedded repository and will not know how to obtain it. 提示:If you meant to add a submodule, use: 提示: 提示: git submodule add <url> themes/next 提示: 提示:If you added this path by mistake, you can remove it from the 提示:index with: 提示: 提示: git rm --cached themes/next 提示: 提示:See "git help submodule" for more information. ➜ /Users/padluo/Projects/Hexo/padluo_blog git:(blog-source) ✗ >git status 位于分支 blog-source 要提交的变更: (使用 "git reset HEAD <文件>..." 以取消暂存) 修改: _config.yml 修改: package-lock.json 修改: package.json 新文件: source/404.md 新文件: source/_posts/demo.md 新文件: source/categories/index.md 新文件: source/tags/index.md 新文件: themes/next 尚未暂存以备提交的变更: (使用 "git add <文件>..." 更新要提交的内容) (使用 "git checkout -- <文件>..." 丢弃工作区的改动) (提交或丢弃子模组中未跟踪或修改的内容) 修改: themes/next (修改的内容)
把自己仓库下面第三方主题添加到 Git 子模块,注意: themes/next 这里的目录是因为我用的 next 主题才会写 themes/next,如果你用的不是 next 请把 next 替换成你的第三方主题文件夹名字。博客的根目录会多一个.gitmodules文件,这是一个配置文件,保存了项目 URL 和你拉取到的本地子目录。