Markdown Preview Enhanced

[toc]

图片

使用 PicGo 插件
快捷键 Ctrl+Alt+U 从剪贴板上传

合并单元格

需要在设置中勾选
Enable Entended Table Syntax to support merging table cells

aa bb cc
1 2 3
1 ^
1 > 3

CodeChunk

code-chunk

  • 调用系统环境变量下的 Python 解释器

    1
    print("Hello World!")
  • 可以用下面的命令查看当前 Python 解释器所在路径, 方便得知其所属的虚拟环境

    {cmd}
    1
    2
    import sys
    print(sys.executable)
  • 使用 id="xxx"continue="xxx" 的方式可以接着 id="xxx" 对应的代码块继续执行

    1
    2
    3
    4
    5
    ```python{cmd id="xxx"}
    ```

    ```python{cmd continue="xxx"}
    ```

    Note: 这里使用 ~~~ 来包裹代码块, 所以可以正常在其中嵌入 ```

    使用 continue 的方式有个弊端, 就是在运行代码块时, 其前置代码块会被重新执行一次

    id
    1
    2
    import numpy
    print(numpy.__version__)
    continue
    1
    print(numpy.__version__)
  • Matplotlib 绘图

    {cmd
    1
    2
    3
    import matplotlib.pyplot as plt
    plt.plot([1,2,3,4])
    plt.show() # show figure

Latex

使用 MPE 嵌入编译 latex 代码需要先配置 latex 环境

Markdown Preview Enhanced also supports LaTeX compilation. Before using this feature, you need to have pdf2svg and LaTeX engine installed.

  • 安装 pdf2svg

    首先从 pdf2svg-windows 下载整个GitHub压缩文件, 将里面的 64/32 位的文件夹整个拷贝到安装目录, 接着在系统环境变量中添加 pdf2svg.exe 所在的 path

    Note: 二进制包直接解压放到安装文件夹即可, 没有安装过程.

  • 安装 LaTeX

    安装最新的 texlive, 可以参考这篇知乎 最新TeXLive 环境的安装与配置

    安装完成后可以使用下面命令检查环境变量是否配置正确

    1
    2
    3
    4
    tex -v
    latex -v
    xelatex -v
    pdflatex -v
  • 测试 MPE 的latex

    {cmd
    1
    2
    3
    4
    \documentclass{standalone}
    \begin{document}
    Hello world!
    \end{document}
  • 测试 tikz 环境

    {cmd
    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
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    \documentclass[border=0.125cm]{standalone}
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \begin{document}

    \tikzset{%
    every neuron/.style={
    circle,
    draw,
    minimum size=1cm
    },
    neuron missing/.style={
    draw=none,
    scale=4,
    text height=0.333cm,
    execute at begin node=\color{black}$\vdots$
    },
    }

    \begin{tikzpicture}[x=1.5cm, y=1.5cm, >=stealth]

    \foreach \m/\l [count=\y] in {1,2,3,missing,4}
    \node [every neuron/.try, neuron \m/.try] (input-\m) at (0,2.5-\y) {};

    \foreach \m [count=\y] in {1,missing,2}
    \node [every neuron/.try, neuron \m/.try ] (hidden-\m) at (2,2-\y*1.25) {};

    \foreach \m [count=\y] in {1,missing,2}
    \node [every neuron/.try, neuron \m/.try ] (output-\m) at (4,1.5-\y) {};

    \foreach \l [count=\i] in {1,2,3,n}
    \draw [<-] (input-\i) -- ++(-1,0)
    node [above, midway] {$I_\l$};

    \foreach \l [count=\i] in {1,n}
    \node [above] at (hidden-\i.north) {$H_\l$};

    \foreach \l [count=\i] in {1,n}
    \draw [->] (output-\i) -- ++(1,0)
    node [above, midway] {$O_\l$};

    \foreach \i in {1,...,4}
    \foreach \j in {1,...,2}
    \draw [->] (input-\i) -- (hidden-\j);

    \foreach \i in {1,...,2}
    \foreach \j in {1,...,2}
    \draw [->] (hidden-\i) -- (output-\j);

    \foreach \l [count=\x from 0] in {Input, Hidden, Ouput}
    \node [align=center, above] at (\x*2,2) {\l \\ layer};

    \end{tikzpicture}

    \end{document}

Markdown

关于缩进

  • 设置 Vocode 的默认缩进

    File -> Preference -> Setting -> Tab Size

    建议修改默认 Tab Size 为 2

  • 指定某个文件的缩进

    右下栏 -> Spaces:4 -> Indent Using Space -> 2

  • 缩进快捷键

    Ctrl + [, Ctrl + ]