0%

Original Post was first published in fullweb.io issue #67

One-line browser notepad 📝

Sometimes you just need to quickly take some notes.

A trick is to use the data: scheme with data:text/html to show just a piece
of HTML in your browser.
Then using the mighty contentEditable to make the whole thing editable.

To copy/paste into your browser address bar:
html data:text/html,<html contenteditable>

And from there you can get fancier. Adding better styling:
html data:text/html,<html contenteditable autofocus style="font: 500 1rem/1.5 Menlo, monospace; background:#fafafa">

From there, no limit: Turning it into a full editor:

From Jake Moffatt:
``html
data:text/html,

``` ` `


NOTE

搬运文章,原创作者:http://joshuablog.herokuapp.com/
Just for study purpose, I don’t hold the copyright, if this is affecting anyone, please let me know.


写在前面

如果用Python写Web的吧,那就不得不提及Django了。我们先借助wiki来了解下吧。

|Django是一个开放源代码的Web应用框架,由Python写成。采用了MVC的软件设计模式,即
|模型M,视图V和控制器C。Django的主要目标是使得开发复杂的、数据库驱动的网站变得简
|单。Django注重组件的重用性和“可插拔性”,敏捷开发和DRY法则(Don’t Repeat
|Yourself)。在Django中Python被普遍使用,甚至包括配置文件和数据模型。—维基百科

上面那段话,我们只需知道Django很好用很快捷就好了。下面我们来看看怎么去搭建一个Django工程。由于操作的时候是在Windows上,所以这里就只写Windows平台了。

安装Python

因为Django是基于Python的,所以安装Django之前我们需要先安装好Python,这个有Python的下载地址 。由于Django最新稳定版推荐使用Python3,所以我们就直接下载最新稳定版的python。下载安装后,我们还需要把Python的安装目录和脚本目录添加到环境变量。如下:

|C:\Python34;C:\Python34\Scripts;

然后我们打开cmd, 输入python

|C:\Users\archerda> python

如果能看见下面这个输出,就说明安装Python成功了。

|C:\Users\archerda>python
|Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
|Type “help”, “copyright”, “credits” or “license” for more information.
|>>>

安装Django

安装Django有 2 种方式,第一种是用 python 自带的 pip,另一种是下载压缩包安装。

  1. pip方式(推荐)

因为pip放在python目录下的Scripts目录下,所以我们必须先把Scripts文件夹的路径放在环境变量中。然后依次执行以下步骤。

  • 用管理员权限打开cmd;
  • 执行

|pip install Django

  • cmd输出以下语句,安装Django成功

|Installing collected packages: Django
|Successfully installed Django-1.8.3

  1. 压缩包方式

先下载压缩包Latest release: Django-1.8.3.tar.gz,下载后放在任意文件夹上,比如

|C:\Django-1.8.3

然后cmd切换到该目录,执行以下命令安装Django

|python setup.py install

以上 2 种方式安装完成后,会生成以下文件夹

|C:\Python34\Lib\site-packages\django

这就是Django的安装目录了。在这里我们需要添加Django环境变量

|C:\Python34\Lib\site-packages;

至此, Django安装完毕。我们可以在cmd检测下。

|C:\Windows\system32> django-admin –version
|1.8.3

新建第一个Django工程

先切入到 Python 的工作区间,比如

|E:\Python

然后,用 django-admin 工具来新建工程,如下

|E:\Python> django-admin startproject testdjango

如此,就会在 E:\Python 生成一个 testdjango 文件夹。文件目录及解释如下:

  • testdjango 工程文件夹
  • testdjango
  • init.py 表明该目录为一个python包
  • settings.py 项目设置文件
  • urls.py URL映射管理
  • wsgi.py Python Web Server Gateway Interface,是Python应用程序或框架和Web服务器之间的一种接口
  • manage.py 对项目进行操作的命令

工程建立完毕。然后激动人心的时刻到了。我们要开始运行这个工程。

  • cmd 切换到 testdjango 工程文件夹下。
  • 执行

|E:\Python\testdjango> manage.py runserver 127.0.0.1:8080

  • cmd 输出

| Performing system checks…
| System check identified no issues (0 silenced).
| You have unapplied migrations; your app may not work properly until they are applied.
| Run ‘python manage.py migrate’ to apply them.
| July 24, 2015 - 10:30:05
| Django version 1.8.3, using settings ‘testdjango.settings’
| Starting development server at http://127.0.0.1:8080/
| Quit the server with CTRL-BREAK.

说明服务器已经成功运行了。

| It worked!
| Congratulations on your first Django-powered page.

至此,第一个Django工程就顺利完工了。

最后,总结下

  • Django的安装

| 1. pip install Django
| 2. python setup.py install

  • App的生成与启动

| django-admin startproject {project_name}

  • 启动服务器

| manage.py runserver [[IP:] 端口]

  • 用浏览器打开URL

| http://localhost:端口/[函数名]

到这里,第一个Django工程就顺利地搭建了。学习Django的第一课,对比Java的Web工程,我觉得Django还是很有意思的。趁着几天,好好学学Python。

完。

Optical Computing: Past and Future

Ravi Athale and Demetri Psaltis
Original
Website
,

Electronic computing’s historical strengths

Conventional wisdom says that electrons compute and photons communicate. That’s
because the strong Coulomb interactions of charged electrons can be leveraged
to perform nonlinear computations (Boolean logic), whereas charge-free photons
do not interact with each other at all in free space.

An electronic computer operates at baseband by manipulating the flow of charges
in semiconductors, such as silicon, whereas most optical systems transfer
information encoded on a carrier frequency of several hundred THz by the
polarization of bound electrons in dielectric materials, such as glasses.
Indeed, the lack of photon-photon interaction makes it possible to use a large
number of spatial and spectral channels to increase the information-carrying
capacity of optical communication systems.

Electronic telecommunication systems evolved from telegraphy, with baseband
operation using simple metal wires for transmission, through telephony, whose
increased demand for transmission bandwidth was initially met by higher carrier
frequencies that require more complex guiding structures such as coaxial
cables, and finally into fiber optic technology for long-haul communications
beginning in the late 1980s. The starting point for computers was similar to
that of early communications systems—that is, simple electrical circuits
operating at baseband frequencies, with bandwidth of several MHz.

Unlike communications however, computers have continued to operate at
baseband—and, thus far, with great success. Computers have acquired complexity
and speed through improvements in the resolution of lithography, which allowed
exponential gains under Moore’s law. Transistors with ever-shrinking dimensions
provide a highly localized interaction between electrical signals (typically
the gate and source voltages), through the 1/r2 drop of the electric field
established by the charge at the gate of the transistor. Such localization is
essential for Boolean logic, in which only two bits typically interact at a
time.

The miniaturization of transistors made possible by ever-finer-scale
lithography leads to increased speed, greater density, lower power and lower
cost (through increased integration)—all at the same time—and has formed the
basis of the microelectronic revolution. In contrast to communications, placing
the data on a high carrier frequency before performing nonlinear logic
computations has offered no obvious advantages.Electronic computing’s
historical strengths

Big data and physical limits

In recent years, it’s been widely recognized that conventional scaling in CMOS
processors is reaching its physical limits, and can’t provide the same
exponential improvement in computational capabilities as in the past. The
computational challenges now posed by so-called big-data analytics are also
necessitating a rethinking at a fundamental level.

All of this has driven increased interest in alternatives to silicon-CMOS-based
hardware for digital computation, a trend captured by a variety of campaigns by
industry groups to “reboot” information technology. These initiatives envision
tight integration among specific applications, alternative models of
computation, and new, potentially unconventional hardware platforms. Proposals
for building optical systems implementing a “reservoir” model of computation—a
variation on neural-net models—constitute one recent example.

In those efforts, nanophotonics could play a key role. The same advances in
lithography and manufacturing that have driven Moore’s law have also, in the
past decade, brought a veritable revolution in photonics technology, making it
possible to precisely create features far smaller than wavelength of light. As
a result, photonic-crystal structures, metamaterials, plasmonics and highly
resonant nanostructures are now enabling unprecedented control over light
propagation, modulation, generation and detection. Novel ideas in bottom-up
self-assembly of materials are also opening new vistas in light-matter
interactions through tools such as quantum dots.

These integrated-photonics developments are leading to exploration of
ever-smaller, ever-higher-performance devices for electrical-to-optical and
optical-to-electrical conversion. They have also rekindled interest in
nonlinear optical switches as logic devices for special-purpose digital optical
circuits—if not as CPUs in general-purpose digital computers. The rapidly
evolving landscape of information processing—and the increasing limits faced by
Moore’s law—makes now an opportune time to explore such advanced
optical-computing techniques.

Vim Cheatsheet

Note: The original post is from github.

Global

1
2
3
4
:help keyword # open help for keyword
:o file # open file
:saveas file # save file as
:close # close current pane

Cursor movement

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
h        # move cursor left
j # move cursor down
k # move cursor up
l # move cursor right
H # move to top of screen
M # move to middle of screen
L # move to bottom of screen
w # jump forwards to the start of a word
W # jump forwards to the start of a word (words can contain punctuation)
e # jump forwards to the end of a word
E # jump forwards to the end of a word (words can contain punctuation)
b # jump backwards to the start of a word
B # jump backwards to the start of a word (words can contain punctuation)
0 # jump to the start of the line
^ # jump to the first non-blank character of the line
$ # jump to the end of the line
g_ # jump to the last non-blank character of the line
gg # go to the first line of the document
G # go to the last line of the document
5G # go to line 5
fx # jump to next occurrence of character x
tx # jump to before next occurrence of character x
} # jump to next paragraph (or function/block, when editing code)
{ # jump to previous paragraph (or function/block, when editing code)
zz # center cursor on screen
Ctrl + b # move back one full screen
Ctrl + f # move forward one full screen
Ctrl + d # move forward 1/2 a screen
Ctrl + u # move back 1/2 a screen

Insert mode - inserting/appending text

1
2
3
4
5
6
7
8
i        # insert before the cursor
I # insert at the beginning of the line
a # insert (append) after the cursor
A # insert (append) at the end of the line
o # append (open) a new line below the current line
O # append (open) a new line above the current line
ea # insert (append) at the end of the word
Esc # exit insert mode

Editing

1
2
3
4
5
6
7
8
9
10
11
r        # replace a single character
J # join line below to the current one
cc # change (replace) entire line
cw # change (replace) to the end of the word
c$ # change (replace) to the end of the line
s # delete character and substitute text
S # delete line and substitute text (same as cc)
xp # transpose two letters (delete and paste)
. # repeat last command
u # undo
Ctrl + r # redo

Marking text (visual mode)

1
2
3
4
5
6
7
8
9
10
11
v        # start visual mode, mark lines, then do a command (like y-yank)
V # start linewise visual mode
o # move to other end of marked area
O # move to other corner of block
aw # mark a word
ab # a block with ()
aB # a block with {}
ib # inner block with ()
iB # inner block with {}
Esc # exit visual mode
Ctrl + v # start visual block mode

Visual commands

1
2
3
4
5
>       # shift text right
< # shift text left
y # yank (copy) marked text
d # delete marked text
~ # switch case

Cut and paste

1
2
3
4
5
6
7
8
9
10
11
12
yy       # yank (copy) a line
2yy # yank (copy) 2 lines
yw # yank (copy) the characters of the word from the cursor position to the start of the next word
y$ # yank (copy) to end of line
p # put (paste) the clipboard after cursor
P # put (paste) before cursor
dd # delete (cut) a line
2dd # delete (cut) 2 lines
dw # delete (cut) the characters of the word from the cursor position to the start of the next word
D # delete (cut) to the end of the line
d$ # delete (cut) to the end of the line
x # delete (cut) character

Search and replace

1
2
3
4
5
6
7
8
/pattern       # search for pattern
?pattern # search backward for pattern
\vpattern # 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)
n # repeat search in same direction
N # repeat search in opposite direction
:%s/old/new/g # replace all old with new throughout file
:%s/old/new/gc # replace all old with new throughout file with confirmations
:noh # remove highlighting of search matches

Search in multiple files

1
2
3
4
:vimgrep /pattern/ {file} # search for pattern in multiple files
:cn # jump to the next match
:cp # jump to the previous match
:copen # open a window containing the list of matches

Exiting

1
2
3
4
5
:w              # write (save) the file, but don't exit
:w !sudo tee % # write out the current file using sudo
:wq or :x or ZZ # write (save) and quit
:q # quit (fails if there are unsaved changes)
:q! or ZQ # quit and throw away unsaved changes

Working with multiple files

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
:e file       # edit a file in a new buffer
:bnext or :bn # go to the next buffer
:bprev or :bp # go to the previous buffer
:bd # delete a buffer (close a file)
:ls # list all open buffers
:sp file # open a file in a new buffer and split window
:vsp file # open a file in a new buffer and vertically split window
Ctrl + ws # split window
Ctrl + ww # switch windows
Ctrl + wq # quit a window
Ctrl + wv # split window vertically
Ctrl + wh # move cursor to the left window (vertical split)
Ctrl + wl # move cursor to the right window (vertical split)
Ctrl + wj # move cursor to the window below (horizontal split)
Ctrl + wk # move cursor to the window above (horizontal split)

Tabs

1
2
3
4
5
6
7
8
9
:tabnew or :tabnew file # open a file in a new tab
Ctrl + wT # move the current split window into its own tab
gt or :tabnext or :tabn # move to the next tab
gT or :tabprev or :tabp # move to the previous tab
<number>gt # move to tab <number>
:tabmove <number> # move current tab to the <number>th position (indexed from 0)
:tabclose or :tabc # close the current tab and all its windows
:tabonly or :tabo # close all tabs except for the current one
:tabdo command # run the command on all tabs (e.g. :tabdo q - closes all opened tabs)

Vim Cheat Map

Modify _config.yml File

默认生成的_config.yml:

1
2
3
4
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type:

修改后的_config.yml:

1
2
3
4
deploy:
type: git
repo: 对应仓库的SSH地址(可以在GitHub对应的仓库中复制)
branch: 分支(User Pages为master,Project Pages为gh-pages)

为了能够使Hexo部署到GitHub上,需要安装一个插件:

1
$ npm install hexo-deployer-git --save

然后,执行下列指令即可完成部署:

1
2
$ hexo generate
$ hexo deploy

之后,可以通过在浏览器键入:username.github.io进行浏览,开心吧~

Deploy MD and config files on github

Methond one:

优化部署与管理

  1. 概述

Hexo部署到GitHub上的文件,是.md(你的博文)转化之后的.html(静态网页)。因此,当你重装电脑或者想在不同电脑上修改博客时,就不可能了(除非你自己写html o(^▽^)o )。

其实,Hexo生成的网站文件中有.gitignore文件,因此它的本意也是想我们将Hexo生成的网站文件存放到GitHub上进行管理的(而不是用U盘或者云备份啦(╬▔皿▔)凸)。这样,不仅解决了上述的问题,还可以通过git的版本控制追踪你的博文的修改过程,是极赞的。

但是,如果每一个GitHub Pages都需要创建一个额外的仓库来存放Hexo网站文件,我感觉很麻烦(10个项目需要20个仓库(ˉ▽ˉ;)…)。

所以,我利用了分支!!!

简单地说,每个想建立GitHub Pages的仓库,起码有两个分支,一个用来存放Hexo网站的文件,一个用来发布网站。

下面以我的博客作为例子详细地讲述。
2. 我的博客搭建流程

创建仓库,CrazyMilk.github.io;
创建两个分支:master 与 hexo;
设置hexo为默认分支(因为我们只需要手动管理这个分支上的Hexo网站文件);
使用git clone git@github.com:CrazyMilk/CrazyMilk.github.io.git拷贝仓库;
在本地CrazyMilk.github.io文件夹下通过Git bash依次执行npm install hexo、hexo init、npm install 和 npm install hexo-deployer-git(此时当前分支应显示为hexo);
修改_config.yml中的deploy参数,分支应为master;
依次执行git add .、git commit -m “…”、git push origin hexo提交网站相关的文件;
执行hexo generate -d生成网站并部署到GitHub上。

这样一来,在GitHub上的CrazyMilk.github.io仓库就有两个分支,一个hexo分支用来存放网站的原始文件,一个master分支用来存放生成的静态网页。完美( •̀ ω •́ )y!
3. 我的博客管理流程

  • 日常修改

在本地对博客进行修改(添加新博文、修改样式等等)后,通过下面的流程进行管理:

依次执行git add .、git commit -m “…”、git push origin hexo指令将改动推送到GitHub(此时当前分支应为hexo);
然后才执行hexo generate -d发布网站到master分支上。

虽然两个过程顺序调转一般不会有问题,不过逻辑上这样的顺序是绝对没问题的(例如突然死机要重装了,悲催….的情况,调转顺序就有问题了)。

  • 本地资料丢失

当重装电脑之后,或者想在其他电脑上修改博客,可以使用下列步骤:

使用git clone git@github.com:CrazyMilk/CrazyMilk.github.io.git拷贝仓库(默认分支为hexo);
在本地新拷贝的CrazyMilk.github.io文件夹下通过Git bash依次执行下列指令:npm install hexo、npm install、npm install hexo-deployer-git(记得,不需要hexo init这条指令)。

Methond two:

使用 hexo,很多人的第一个困惑就是,如何保存 README.md 文件。网上的方法是,在
source 目录下存放 README.md 文件。但这还不够,因为在进行 hexo generate 时会把
README.md 渲染成 README.html。

Use skip_render command to omit the fils with .md and .yml. This commend by
default use source/ directory.

skip_render: README.md # 禁止进行渲染的文件

The file tree under source/ folder should look like the following:

│ README.md

├─categories
│ index.md

├─ori_data
│ │ config.yml
│ │
│ ├─categories
│ │ index.md
│ │
│ ├─posts
│ │ 2013-02-05-my-blog-in-github.md
│ │ 2013-02-06-resolve-goagent-cp65001.m
│ │ 2013-03-11-c_stack.md
│ │ 2015-05-03-hello-hexo.md
│ │
│ ├─tags
│ │ index.md
│ │
│ └─themes
│ └─next
│ config.yml

├─tags
│ index.md

└─_posts
2013-02-05-my-blog-in-github.md
2013-02-06-resolve-goagent-cp65001.md
2013-03-11-c_stack.md
2013-03-18-understand_typdef_funp.md
2013-03-24-understand_container_of.md
2015-05-03-hello-hecommend by

The _config.yml file should be modified to :

1
2
3
4
5
6
7
8
9
10
11
12
...
# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render: [README.md, ori_data/*, ori_data/posts/*, ori_data/tags/*,
ori_data/categories/*, ori_data/themes/next/*] # 禁止进行渲染的文件
...

P.S.

  • Need to change the _config.yml or _post/ to config.yml and post/,
    because they will be omitted with _ prefix.
  • After the configuration, we can run hexo generate and hexo deploy, we can
    cd into .deploy_git/ directory, and take a look at the following file
    tree.
  • After this, you can simply make modification in source/_posts/ directory
    and then copy the files to source/ori_data/posts/.

Reference

  1. 将原始的 .md 文件纳入 hexo
    的版本管理
  2. GitHub Pages + Hexo搭建博客

最近 Vim 和 LaTex 用的都比较多,积累了一些经验,如果你也经常使用 Vim来编辑 LaTex 文档,不妨尝试一下我推荐的快捷键、命令以及插件。这些技巧都会提升写作效率,才能享 受写作的乐趣。

一、快捷键

  1. = 自动格式化对齐样式,对于有代码洁癖强迫症的人来说绝对是福音。

  2. gq家族 根据 textwidth 自动换行。gqgq: 换行当前段。gqap: 格式化整个段。{Visual}gq: 格式化选定的部分。对于每行字符数量不能超过 80 的人来说,又一个福音。最后你的文章会非常整齐,就像这样:

Vim (an acronym for Vi IMproved) is a text editor written by Bram Moolenaar and first released publicly in 1991. Based on the vi editor common to Unix-like systems, Vim is designed for use both from a command line interface and as a standalone application in a graphical user interface. Vim is free and open source software and is released under a license that includes some charityware clauses, encouraging users who enjoy the software to consider donating to children in Uganda. The license is compatible with the GNU General Public License.

二、命令 & .vimrc

  1. :set spell 经常写英文的人会用得到的,一不小心打错单词了,Vim 会在单词上加一个下划线提示。你还可以把你认为正确的特殊单词加到字典里面。

  2. autocmd BufNewFile,BufRead *.tex set spell 把这句话加到 .vimrc 里面可以在打开 .tex 文件的时候自动进行拼写检查。

  3. let g:tex_indent_items=0 估计大家都打开了换行时自动对齐的功能,但是有没有发现这样一个问题,在用 itemize 的时候,每一个 item 都会自动缩进两个,非常麻烦。如果你懒得搞的话,最后就变成了这个样子:

\begin{itemize}
\item fist …
\item second …
\item third …
\end{itemize}

如果在 .vimrc 里面加入 let g:tex_indent_items=0 一句话,自动缩进终于变得正常了。

三、插件

  1. UltiSnips 无论是编辑 LaTex 文档还是写代码,UltiSnips 绝对是利器。他可以自动补全常用的代码结构。拿 Tex 举例,输入 item 就会出来:

item
\begin{itemize}
\item
\end{itemize}

fig
\begin{figure}[htpb]
\centering
\includegraphics[width=0.8\linewidth]{name.ext}
\caption{Name}
\label{fig:name}
\end{figure}

lp
\left(contents\right)

还有非常多的自动补全,\begin{}…\end{} \section{}…。当然,你还可以编写自己的 snippets。用了这个插件,写东西的时候有一种畅快淋漓的感觉,再也不用纠结乱起八糟的命令了。可以看一下作者录制的四个 screencasts,了解 UltiSpips 更强大的功能。

  1. Align 用 Align 来对齐表格,又一个强迫症的福音。

\begin{tabular}{cccc}
a & b & c & d \
Ef & long long & ss & a \
test & n & long content & small \
\end{tabular}
“ 选中表格内容,按 tt,就可以对齐了,豁然开朗。
\begin{tabular}{cccc}
a & b & c & d \
Ef & long long & ss & a \
test & n & long content & small \
\end{tabular}

  1. Syntastic Syntastic 是语法检查的利器。对于 Tex
    文档来说,你总不想到编译的时候才发现 & 符号没有用转移字符 & 吧。Syntastic
    会动态的检查 Tex
    文档的语法,除了语法错误的提示,他还会有一些语法的建议。附一张官方的图,这是多么的方便啊!

其他

还有一些不在强烈建议的列表当中,但是也非常的有用。比如说单词补全的插件:neocompletecache。或者直接从
markdown 转成 tex 文档,让你完全专注于写作: pandoc。剩下的都是是看个人喜好了。

Update: 还有一个非常重要的工具,latexmk,是 LaTex 的 Makefile。好像 tex-live 的包里面直接就带了。有了他,就可以左边开一个 Vim,右边放一个 PDF。然后在 Vim 中保存修改,右面 PDF 就会自动更新。想达到这样的效果,首先要建立一个配置文件 .latexmkrc,里面写上:

$pdf_previewer = “start evince %O %S”;

这里是为了制定默认的 PDF 浏览器。设置完之后,只要运行 latexmk 命令就能自动监控 tex 文件的修改,然后重新编译。

latexmk -pdf -pvc xxx.tex // 用 pdflatex 编译,同时打开 PDF 浏览,并监控修改
latexmk -xelatex -pvc xxx.tex // 用 xelatex 编译,同时打开 PDF 浏览,并监控修改
latexmk -c // 删除生成的中间文件

Create mvn project: mvn archetype:generate mvn archetype:generate -DgroupId=<your-groupId> -DartifactId=<your-artifactId> -Dversion=<version> -Dpackage=<package-name>


Vim command map

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists
look like:

  • this one
  • that one
  • the other one

Note that — not considering the asterisk — the actual text
content starts at 4-columns in.

Block quotes are
written like so.

They can span multiple paragraphs,
if you like.

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., “it’s all
in chapters 12–14”). Three dots … will be converted to an ellipsis.
Unicode is supported. ☺

An h2 header

Here’s a numbered list:

  1. first item
  2. second item
  3. third item

Note again how the actual text starts at 4 columns in (4 characters
from the left side). Here’s a code sample:

# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }

As you probably guessed, indented 4 spaces. By the way, instead of
indenting the block, you can use delimited blocks, if you like:

1
2
3
define foobar() {
print "Welcome to flavor country!";
}

(which makes copying & pasting easier). You can optionally mark the
delimited block for Pandoc to syntax highlight it:

1
2
3
4
5
6
import time
# Quick, count to ten!
for i in range(10):
# (but not *too* quick)
time.sleep(0.5)
print i

An h3 header

Now a nested list:

  1. First, get these ingredients:

    • carrots
    • celery
    • lentils
  2. Boil some water.

  3. Dump everything in the pot and follow
    this algorithm:

    find wooden spoon
    uncover pot
    stir
    cover pot
    balance wooden spoon precariously on pot handle
    wait 10 minutes
    goto first step (or shut off burner when done)

    Do not bump wooden spoon or it will fall.

Notice again how text always lines up on 4-space indents (including
that last line which continues item 3 above).

Here’s a link to a website, to a local
doc
, and to a section heading in the current
doc
. Here’s a footnote [^1].

[^1]: Footnote text goes here.

Tables can look like this:

size material color


9 leather brown
10 hemp canvas natural
11 glass transparent

Table: Shoes, their sizes, and what they’re made of

(The above is the caption for the table.) Pandoc also supports
multi-line tables:


keyword text


red Sunsets, apples, and
other red or reddish
things.

green Leaves, grass, frogs
and other things it’s
not easy being.


A horizontal rule follows.


Here’s a definition list:

apples
: Good for making applesauce.
oranges
: Citrus!
tomatoes
: There’s no “e” in tomatoe.

Again, text is indented 4 spaces. (Put a blank line between each
term/definition pair to spread things out more.)

Here’s a “line block”:

| Line one
| Line too
| Line tree

and images can be specified like so:

example image

Inline math equations go in like so: $\omega = d\phi / dt$. Display
math should get its own line and be put in in double-dollarsigns:

$$I = \int \rho R^{2} dV$$

And note that you can backslash-escape any punctuation characters
which you wish to be displayed literally, ex.: `foo`, *bar*, etc.–