g

丘海东

读书写字 热爱生活 ⌚️📖️🖋️🏀️🚲️🚉️🎼️🍵️🏞️📷️

水汶

会说谎

守时

职责、职能、职权——分明

人脉、信任

经营者心态

Markdown语法 2

首先表明,此文转载自

作业部落旗下

东哥再次感谢作者

欢迎使用 Cmd - 在线 Markdown 编辑阅读器


我们理解您需要更便捷更高效的工具记录思想,整理笔记、知识,并将其中承载的价值传播给他人,Cmd Markdown 是我们给出的答案 —— 我们为记录思想和分享知识提供更专业的工具。

您可以使用 Cmd Makrdown

  • 整理知识,学习笔记
  • 撰写发布技术文稿(代码支持)
  • 撰写发布学术论文(公式支持)
  • 发布日记,杂文,所见所想

这是一份 Cmd Markdown 的欢迎稿兼使用说明,请保留,如需撰写新稿件, 请在编辑-预览模式下,点击顶部工具栏右侧的新建文本图标或者使用快捷键 Ctrl+Alt+N


什么是 Markdown

Markdown 是一种方便记忆、书写的纯文本标记语言,用户可以使用这些标记符号以最小的输入代价生成极富表现力的文档:譬如您正在阅读的这份文档。它使用简单的符号标记不同的标题,分割不同的段落,粗体 或者 斜体 某些文字,更棒的是,它还可以

  • 书写一个质能守恒公式:

$E=mc2$

  • 或者高亮一段代码:
1
2
3
4
class SomeClass:
    pass
if __name__ == '__main__':
    print 'hello world'

想要了解更详细的语法说明,可以参考我们准备的 Markdown 语法简明手册

总而言之,不同于其它 所见即所得 的编辑器:您只需使用键盘专注于书写文本内容,就可以生成印刷级的排版格式,省却在键盘和工具栏之间来回切换,调整内容和格式的麻烦。Markdown 在流畅的书写和印刷级的阅读体验之间找到了平衡。 它目前已经成为世界上最大的技术分享网站 GitHub 和 技术问答网站 StackOverFlow 的御用书写格式。


什么是 Cmd Markdown

您可以使用很多工具书写 Markdown,但是 Cmd Markdown 是这个星球上我们已知的、最好的 Markdown 工具——没有之一 :)因为深信文字的力量,所以我们和你一样,对流畅书写,分享思想和知识,以及阅读体验有极致的追求,我们把对于这些诉求的回应整合在 Cmd Markdown,并且一次,两次,三次,乃至无数次地提升这个工具的体验,最终将它演化成一个 编辑/发布/阅读 Markdown 的在线平台——您可以在任何地方,任何系统/设备上管理这里的文字。

1. 实时同步预览

我们将 Cmd Markdown 的主界面一分为二,左边为编辑区,右边为预览区,在编辑区的操作会实时地渲染到预览区方便查看最终的版面效果,并且如果你在其中一个区拖动滚动条,我们有一个巧妙的算法把另一个区的滚动条同步到等价的位置,超酷!

2. 编辑工具栏

也许您还是一个 Markdown 语法的新手,在您完全熟悉它之前,我们在 编辑区 的顶部放置了一个如下图所示的工具栏,您可以使用鼠标在工具栏上调整格式,不过我们仍旧鼓励你使用键盘标记格式,提高书写的流畅度。

tool-editor

3. 编辑模式

如果您还想以更加心无旁骛的方式编辑文字,可以点击 编辑工具栏 最右测的拉伸按钮或者按下 Ctrl + M,将 Cmd Markdown 切换到独立的编辑模式,这是一个极度简洁的写作环境,所有可能会引起分心的元素都已经被挪除,超清爽!

4. 实时的云端文稿

为了保障数据安全,Cmd Markdown 会将您每一次击键的内容保存至云端,同时在 编辑工具栏 的最右侧提示 “已保存” 的字样。无需担心浏览器崩溃,机器掉电或者地震,海啸——在编辑的过程中随时关闭浏览器或者机器,下一次回到 Cmd Markdown 的时候继续写作。

5. 管理工具栏

为了便于管理您的文稿,在 预览区 的顶部放置了如下所示的 管理工具栏

tool-manager

工具栏上的四个图标依次为:

  • 立即发布:将当前的文稿生成到固定链接,在网络上发布这个链接,分享您的文稿
  • 新建文本:开始撰写一篇新的文稿
  • 删除文本:删除当前的文稿
  • 导出文本:将当前的文稿转化为 Markdown 文本或者 Html 格式,并导出到本地

6. 阅读工具栏

tool-manager

通过在 预览区 顶部右侧的 阅读工具栏,可以查看文稿列表,增强阅读体验

工具栏上的四个图标依次为:

  • 文稿列表:所有新增和过往的文稿都可以在这里查看、操作
  • 主题切换:内置了黑白两种模式的主题,试试 黑色主题,超炫!
  • 阅读模式:心无旁骛的阅读模式提供超一流的阅读体验
  • 全屏模式:简洁,简洁,再简洁,一个完全沉浸式的写作和阅读环境

7. 阅读模式

阅读工具栏 点击 阅读模式 图标或者按下 Ctrl+Alt+M 随即进入独立的阅读模式界面,我们在版面渲染上的每一个细节:字体,字号,行间距,前背景色都倾注了大量的时间,努力提升您阅读的体验和品质。尝试进入阅读模式,感受这份诚意。

8. 文稿发布和分享

在您使用 Cmd Markdown 记录,创作,整理,阅读文稿的同时,我们不仅希望它是一个有力的工具,更希望您的思想和知识通过这个平台,连同优质的阅读体验,将他们分享给有相同志趣的人,进而鼓励更多的人来到这里记录分享他们的思想和知识,尝试点击 立即发布 图标发布这份文档给好友吧!


再一次感谢您花费时间阅读这份欢迎稿,点击 新建文本(Ctrl+Alt+N) 开始撰写新的文稿吧!祝您在这里记录、阅读、分享愉快!

作者 @ghosert
于 2013 年 10月 3日
上海

Error: UTF-8 无效字符

1.dconf-editor

2.首次安装尽量要做这几步:

rake setup_github_pages
rake generate
rake deploy
git add . 
git commit -m 'your message'
git push origin source

3.然后再edit _config.yml及添加按钮等等

4.做完3后,rake generate ,可能又会有utf-8问题,因为之前编辑的文件可能又变了,再打开看一次,纠错

5.多试多看几遍,也可在命令后加 –trace 追踪查看

Error: Could Not Find Expected ':'

出现错误要先看提示代码,知道错在哪里,如:

dong@ubuntu:~/octopress$ rake generate
## Generating Site with Jekyll
identical source/stylesheets/screen.css 
/home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (/home/dong/octopress/_config.yml): could not find expected ':' while scanning a simple key at line 10 column 1 (Psych::SyntaxError)
    from /home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:127:in `load'
    from /home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:297:in `block in load_file'
    from /home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:297:in `open'
    from /home/dong/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:297:in `load_file'
    from /home/dong/.rvm/gems/ruby-1.9.3-p448/gems/jekyll-0.12.0/lib/jekyll.rb:130:in `configuration'
    from /home/dong/.rvm/gems/ruby-1.9.3-p448/gems/jekyll-0.12.0/bin/jekyll:221:in `<top (required)>'
    from /home/dong/.rvm/gems/ruby-1.9.3-p448/bin/jekyll:23:in `load'
    from /home/dong/.rvm/gems/ruby-1.9.3-p448/bin/jekyll:23:in `<main>'
    from /home/dong/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `eval'
    from /home/dong/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `<main>'

代码已经说得很清楚了,就是/home/dong/octopress/_config.yml,这个文件,could not find expected ‘:’ while scanning a simple key at line 10 column 1 (Psych::SyntaxError)
就是':'后面忘了加空格

Markdown语法简明手册

首先表明,本文转载自 http://ghosertblog.github.io/mdeditor/

东哥对作者表示:万分感谢

Markdown 语法简明手册

1. 使用 * 和 ** 表示斜体和粗体

示例:

这是 斜体,这是 粗体

2. 使用 === 表示一级标题,使用 — 表示二级标题

示例:

这是一个一级标题

这是一个二级标题

这是一个三级标题

注意,别忘了 # 后面加空格 ,不然有些版本会失败

你也可以选择在行首加井号表示不同级别的标题,例如:# H1, ## H2, ### H3。

3. 使用 [描述](链接地址) 为文字增加外链接

示例:

这是去往 作者本人博客 的链接。

4. 在行末加两个空格表示换行

示例:

第一行(此行最右有两个看不见的空格)
第二行

5. 使用 *,+,- 表示无序列表

示例:

  • 无序列表项 一
  • 无序列表项 二
  • 无序列表项 三

6. 使用数字和点表示有序列表

示例:

  1. 有序列表项 一
  2. 有序列表项 二
  3. 有序列表项 三

7. 使用 > 表示文字引用

示例:

野火烧不尽,春风吹又生

8. 使用 `代码` 表示行内代码块

示例:

让我们聊聊 html

9. 使用 四个缩进空格 表示代码块

示例:

这是一个代码块,此行左侧有四个不可见的空格

10. 使用 ![描述](图片链接地址) 插入图像

示例:

我的头像

11. 使用\~~~~\添加删除线

示例:

删除线

Setup and Start Octopress

Before You Begin

Install Git

don't need anymore: sudo apt-add-repository ppa:git-core/ppa
don't need anymore: sudo apt-get update
sudo apt-get install git

然后就应该跳到后面的Before Deploying to Github Pages, Set Up Git

Install Ruby (the larest version) using either rbenv or RVM

Install RVM:

don't need anymore: curl -L https://get.rvm.io | bash -s stable --ruby
use this: 
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable

maybe there is some other command come out, and it may ask you to run it, follow it, run: curl -sSL https://get.rvm.io | bash -s stableagain. then it should be successed.

Be sure to follow any subsequent instructions as guided by the installation process.

2016-05-21:这里可能会报错,按照它的英文提示做(它会给出命令),能通过

Install Ruby lastest vesion

check for the curent (latest) version on the official website

rvm install 2.3.1
rvm use 2.3.1
rvm rubygems latest

Runruby --versionto be sure you’re using Ruby 2.3.1

Setup Octopress

no more:  git clone git://github.com/imathis/octopress.git octopress
git clone -b source git@github.com:qiuhaidong/qiuhaidong.github.com.git octopress
cd octopress    # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes).
ruby --version  # Should report Ruby 1.9.3

git octopress

git clone git@github.com:qiuhaidong/qiuhaidong.github.com.git _deploy

if:

1
2
3
4
5
6
dong@Ubuntu:~/octopress$ git clone git@github.com:username/repositoryname.git _deploy
正克隆到 '_deploy'...
ERROR: Repository not found.
fatal: 无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

github官方访问权限认证方式更改ssh to https

Next, install dependencies

gem install bundler
sudo apt-get install rbenv
rbenv rehash    # If you use rbenv, rehash to be able to run the bundle command
bundle install

Install the default Octopress theme.

rake install

Next Steps

1. Set up deployment
2. Configure your blog
3. Start blogging with Octopress

Deploying to Github Pages

Before Deploying to Github Pages,Set Up Git

Username

First you need to tell git your name, so that it can properly label the commits you make.

git config --global user.name "Your Name Here"
我的就是:git config --global user.name "qiuhaidong"
# Sets the default name for git to use when you commit

Email

Git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.

git config --global user.email "your_email@example.com"
我的就是:git config --global user.email "690982322@qq.com"
# Sets the default email for git to use when you commit

Password caching

To use this option, you need to turn on the credential helper so that git will save your password in memory for some time:

git config --global credential.helper cache
# Set git to use the credential memory cache

Generating SSH Keys

Step 1: Check for SSH keys

First, we need to check for existing ssh keys on your computer. Open up Terminal and run:

cd ~/.ssh
# Checks to see if there is a directory named ".ssh" in your user directory

If it says “No such file or directory” go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.

最好就是把 .shh 这个文件夹删除了,做step2

Step 2: Generate a new SSH key

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

ssh-keygen -t rsa -C "your_email@example.com"
我的就是:ssh-keygen -t rsa -C "690982322@qq.com"

Now you need to enter a passphrase.

Which should give you something like this:

Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com

Step 3: Add your SSH key to GitHub

sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)

xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

Add your SSH key to GitHub

到github网站,登陆,头像,设置,SSH and GPG keys,把旧的SSH keys删除,添加新的,title不用管,粘贴到key就行了

Step 4: Test everything out

ssh -T git@github.com

这里可能会还要按照提示做一下,不难,看英文做

if cout<<

Hi username! You've successfully authenticated, but GitHub does not provide shell access.

If that username is correct, you’ve successfully set up your SSH key. Don’t worry about the shell access thing, you don’t want that anyway.

If you see “access denied” please consider using HTTPS instead of SSH. If you need SSH start at these instructions for diagnosing the issue.

Now Go Back to:Deploying to Github Pages

rake setup_github_pages

This will ask you for something

Next run:

rake generate
rake deploy

This will generate your blog, copy the generated files into _deploy/, add them to git, commit and push them up to the master branch. In a few seconds you should get an email from Github telling you that your commit has been received and will be published on your site.

Don’t forget to commit the source for your blog.

git add .           # don't forget the "."
git commit -m 'your message'
git push origin source

Configuring Octopress

edit _config.yml

Main Configs

url:                # For rewriting urls for RSS, etc
title:              # Used in the header and title tags
subtitle:           # A description used in the header
author:             # Your name, for RSS, Copyright, Metadata
simple_search:      # Search engine for simple site search
description:        # A default meta description for your site
date_format:        # Format dates using Ruby's date strftime syntax
subscribe_rss:      # Url for your blog's feed, defauts to /atom.xml
subscribe_email:    # Url to subscribe by email (service required)
category_feeds:     # Enable per category RSS feeds (defaults to false in 2.1)
email:              # Email address for the RSS feed if you want it.

Blogging Basics

new blog:

rake new_post["title"]

Generate & Preview(生成&预览)

rake generate   # Generates posts and pages into the public directory
rake watch      # Watches source/ and sass/ for changes and regenerates
rake preview    # Watches, and mounts a webserver at http://localhost:4000

If you want to work on posts without publishing them, you can add a published: false to your post’s YAML header. You can preview these posts with rake preview on your local server, but they won’t get published by rake generate.

发布:

rake deploy

OK!That’s it.

2015-8-28
这篇博文讲得很好,推荐看看