• [linux] 使用markdown写文档


    github上很多项目都使用*.md来做说明文档 github上会自动将.md文件内容转成html进行呈现

    想用go来写个相关的解析器,顺便练手!!~

     

    # markdown地址
    http://daringfireball.net/projects/markdown/

    # 下载安装
    wget http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
    unzip Markdown_1.0.1.zip
    cd Markdown_1.0.1/

    # 编译tags文件&查看
    $./Markdown.pl --html4tags foo.md > foo.html
    $firefox foo.html &

    # 语法

    foo.md

    This is an H1
    =============
    
    this is an h2
    ---------------
    
    # This is an H1
    ## This is an H2
    ### This is an H3
    #### This is an H4
    ##### This is an H5
    ###### This is an H6
    
    # This is an H1 #
    ## This is an H2 #
    ### This is an H3 #
    #### This is an H4 #
    ##### This is an H5 #
    ###### This is an H6 #
    
    ## HTML ##
    This is a regular paragraph.
    
    <table>
        <tr>
            <td>Foo</td>
        </tr>
    </table>
    
    This is another regular paragraph.
    
    ## BLOCK ##
    ###### block.eg1 #
    > This is the first level of quoting.
    >
    > > This is nested blockquote.
    >
    > Back to the first level.
    
    ###### block.eg2 #
    > ## This is a header.
    > 
    > 1.   This is the first list item.
    > 2.   This is the second list item.
    > 
    > Here's some example code:
    > 
    >     return shell_exec("echo $input | $markdown_script");
    
    ###### block.code.eg1 #
    Here is an example of AppleScript:
    
        tell application "Foo"
            beep
        end tell
    
    ###### block.code.eg2 #
    ``There is a literal backtick (`) here.``
    
    ## LIST ##
    
    ###### list.eg1 #
    *  red
    *  green
    *  blue
    
    ###### list.eg2 #
    +  red
    +  green
    +  blue
    
    ###### list.eg3 #
    -  red
    -  green
    -  blue
    
    ###### list.eg4 #
    1. red
    2. green
    3. blue
    
    ## HORIZONTAL RULES #
    
    * * *
    ***
    ******
    - - -
    ---------------------------------
    
    ## LINK #
    This is [an example](http://example.com/ "Title") inline link.
    
    [This link](http://example.net/) has no title attribute.
    
    ## EMPHASIS #
    
    *single asterisks*
    
    _single underscores_
    
    **double asterisks**
    
    __double underscores__
    
    ## IMAGE #
    ![Alt text](/path/to/img.jpg)
    
    ![Alt text](/path/to/img.jpg "Optional title")
    
    ![Alt text](http://www.google.com.hk/images/srpr/logo3w.png "Optional title")
    
    ## MISC #
    ###### AUTOMATIC LINKS  #
    <http://www.163.com>
    
    <address@example.com>
  • 相关阅读:
    (初学者)安装hadoop集群注意事项
    配置HADOOP_HOME
    修改用户所在组,修改文件的所有者,明明是自己的文件什么不能解压?
    方法被阻塞,一直要等到线程任务返回结果的例子
    Python复习笔记(一)高级变量类型
    我的vim插件配置
    vim使用笔记
    Linux命令(九)查找文件find
    Linux命令(八)Linux系统信息相关命令
    Linux命令(七)Linux用户管理和修改文件权限
  • 原文地址:https://www.cnblogs.com/bluefrog/p/2652526.html
Copyright © 2020-2023  润新知