我想,在我正式开始学习一些计算机课程和如何搭建个人博客网站之前,我要重新将Markdown从头到尾地学习一下。事实上,这篇文章也是使用Markdown格式来进行书写的。
很早就听说了Markdown的大名,<u>目前一些主流的博客网站或者论坛,还有一些社交媒体都支持以Markdown格式进行创作。</u>
然而我却一直没有系统学习和了解Markdown,它于我而言有些像最熟悉的陌生人。
那什么是Markdwon?为什么要学习它,它有什么用呢?
下面简单地介绍一下Markdown
Markdown是一种轻量级标记语言,创始人为约翰·格鲁伯。它允许人们使用易读易写的纯文本格式编写文档,然后转换成有效的XHTML(或者HTML)文档。[4]这种语言吸收了很多在电子邮件中已有的纯文本标记的特性。
由于Markdown的轻量化、易读易写特性,并且对于图片,图表、数学式都有支持,目前许多网站都广泛使用Markdown来撰写帮助文档或是用于论坛上发表消息。如GitHub、Reddit、Discord、Diaspora)、Stack Exchange、OpenStreetMap 、SourceForge、简书等,甚至还能被用来撰写电子书。
这是引用自维基百科中关于Markdown的定义说明,实际上Markdown就是用来给你所写的文档添加一些格式,使其变得更加易读,但是它又不像富文本编辑器(如Word)那样繁琐,当然它的格式也远没有富文本编辑器那么丰富,它的有点在于方便快捷,可以满足写文档的基本需求,可以释放你的右手,你的双手完全不需要离开键盘,而且越来越多的网站也开始兼容Markdown,因此学习Markdown可以有利于编写你自己的文档。
刚才简单介绍了一下Markdown,下面着重介绍Markdown如何使用,也就是介绍一下Markdown的语法
标题语法
在要创建的标题前添加井号(#
),井号的个数代表不同的标题等级,例如
\# 一级标题
\## 二级标题
\### 三级标题
\#### 四级标题
\##### 五级标题
\###### 六级标题
这里所展现出的效果如下:
一级标题
二级标题
三级标题
四级标题
五级标题
六级标题
它们随着级数越来越大,重要级缺越来越小,这像书本中可能会出现的,第一章、1.1节、1.1.1,有一个逐级向下细分的过程,在我使用Typora写这篇文章的时候,我发现一级和二级标题下方会有一条浅色的分割线。
正文语法
当我们写完标题后,就该写正文了,也就是自然段(段落),在Markdown中,以空白行分割出不同的段落,并且不对段落做缩进处理,就是说段落与段落之间有空行,段落不用首行缩进二字符。当你写正文时发现内容过长,需要换行,此时为了兼容性,最好在句子末尾加上\<br>以换行,或者干脆将那部分正文分成若干段落
强调语法
在文章中可能会有某些重要的词语或短句需要引起读者注意,此时可以通过加粗、倾斜、下划线、删除线来达到强调的目的,下面介绍这三种样式的语法:
1.加粗
在要加粗的内容前后分别输入两个星号(**
)
如:这是一个*加粗*示例
那么它呈现出来的效果应该是这样的:
这是一个加粗示例
2.倾斜
在要倾斜的内容前后分别输入一个星号(*
)
如:这是一个*倾斜*示例
那么它呈现出的效果应该是这样的:
这是一个倾斜示例
3.下划线
由于Markdown原生语法并不支持给文字下划线,这里我们使用HTML来完成,把要加下划线的内容放到\<u>\</u>中
如:这是一个\<u>下划线\</u>示例
它呈现出的效果是这样的:
这是一个<u>下划线</u>示例
4.删除线
在要加删除线的内容前后分别输入两个波浪号(~~
)
如:这是一个\~~删除线~~示例
它呈现的效果应该是这样的:
这是一个删除线示例
引用语法
当你在写正文段落时,有时可能需要借用一下别人的话,这时引用语法就起了作用
它的用法是,在一行用一个大于号(>
)来表示,如果你的引用有好几行,你需要在每行开头都加上一个大于号,就像这样:
\>这就是我要引用的话!
它呈现的效果就是这样:
这就是我要呈现的话啦!
代码语法
代码块和引用块的用法比较像,在写技术文档时,你可能会需要展示一段代码,Markdown中的代码块可以让你的代码与普通文本区分开,根据不同的语法为其添加高亮,使其便于阅读
它的语法是,在你的代码段前后分别加上三个反引号(\```),这个符号和波浪号在一个按键上,在前面三个反引号后面可以紧接着写此代码段是什么编程语言,就像这样:
\```c++
int main(){
cout>>"这是一个代码段示例";
}
\```
它呈现出的效果就是这样:
int main(){
cout>>"这是一个代码段示例";
}
这里代码高亮的样式即为C++风格
那么Markdown中代码段都支持哪些编程语言呢?见下表
语言名称 | Markdown 语言声明 | 常见文件名 |
---|---|---|
1C Enterprise | 1c-enterprise | *.bsl |
4D | 4d | *.4dm |
ABAP | abap | *.abap |
ABNF | abnf | *.abnf |
AGS Script | ags-script, ags | *.asc |
AMPL | ampl | *.ampl |
ANTLR | antlr | *.g4 |
API Blueprint | api-blueprint | *.apib |
APL | apl | *.apl |
ASN.1 | asn.1 | *.asn |
ASP | asp, aspx, aspx-vb | *.asp |
ATS | ats, ats2 | *.dats |
ActionScript | actionscript, actionscript3, as3 | *.as |
Ada | ada, ada95, ada2005 | *.adb |
Adobe Font Metrics | adobe-font-metrics, acfm, amfm | *.afm |
Agda | agda | *.agda |
Alloy | alloy | *.als |
Alpine Abuild | alpine-abuild, abuild, apkbuild | APKBUILD |
Altium Designer | altium-designer, altium | *.OutJob |
AngelScript | angelscript | *.as |
Ant Build System | ant-build-system | ant.xml |
ApacheConf | apacheconf, aconf, apache | *.apacheconf, .htaccess |
Apex | apex | *.cls |
Apollo Guidance Computer | apollo-guidance-computer | *.agc |
AppleScript | applescript, osascript | *.applescript |
Arc | arc | *.arc |
AsciiDoc | asciidoc | *.asciidoc |
AspectJ | aspectj | *.aj |
Assembly | assembly, asm, nasm | *.asm |
Asymptote | asymptote | *.asy |
Augeas | augeas | *.aug |
AutoHotkey | autohotkey, ahk | *.ahk |
AutoIt | autoit, au3, AutoIt3, AutoItScript | *.au3 |
Awk | awk | *.awk |
Ballerina | ballerina | *.bal |
Batchfile | batchfile, bat, batch, dosbatch, winbatch | *.bat |
Befunge | befunge | *.befunge |
BibTeX | bibtex | *.bib |
Bison | bison | *.bison |
BitBake | bitbake | *.bb |
Blade | blade | *.blade |
BlitzBasic | blitzbasic, b3d, blitz3d, blitzplus, bplus | *.bb |
BlitzMax | blitzmax, bmax | *.bmx |
Bluespec | bluespec | *.bsv |
Boo | boo | *.boo |
Brainfuck | brainfuck | *.b |
Brightscript | brightscript | *.brs |
C | c | *.c |
C# | c#, csharp | *.cs |
C++ | c++, cpp | *.cpp |
C-ObjDump | c-objdump | *.c-objdump |
C2hs Haskell | c2hs-haskell, c2hs | *.chs |
CLIPS | clips | *.clp |
CMake | cmake | *.cmake, CMakeLists.txt |
COBOL | cobol | *.cob |
COLLADA | collada | *.dae |
CSON | cson | *.cson |
CSS | css | *.css |
CSV | csv | *.csv |
CWeb | cweb | *.w |
Cabal Config | cabal-config, Cabal | *.cabal, cabal.config |
Cap’n Proto | cap’n-proto | *.capnp |
CartoCSS | cartocss, Carto | *.mss |
Ceylon | ceylon | *.ceylon |
Chapel | chapel, chpl | *.chpl |
Charity | charity | *.ch |
ChucK | chuck | *.ck |
Cirru | cirru | *.cirru |
Clarion | clarion | *.clw |
Clean | clean | *.icl |
Click | click | *.click |
Clojure | clojure | *.clj, riemann.config |
Closure Templates | closure-templates, soy | *.soy |
Cloud Firestore Security Rules | cloud-firestore-security-rules | firestore.rules |
CoNLL-U | conll-u, CoNLL, CoNLL-X | *.conllu |
CodeQL | codeql, ql | *.ql |
CoffeeScript | coffeescript, coffee, coffee-script | *.coffee, Cakefile |
ColdFusion | coldfusion, cfm, cfml | *.cfm |
ColdFusion CFC | coldfusion-cfc, cfc | *.cfc |
Common Lisp | common-lisp, lisp | *.lisp |
Common Workflow Language | common-workflow-language, cwl | *.cwl |
Component Pascal | component-pascal, delphi, objectpascal | *.cp |
Cool | cool | *.cl |
Coq | coq | *.coq |
Cpp-ObjDump | cpp-objdump, c++-objdump | *.cppobjdump |
Creole | creole | *.creole |
Crystal | crystal | *.cr |
Csound | csound, csound-orc | *.orc |
Csound Document | csound-document, csound-csd | *.csd |
Csound Score | csound-score, csound-sco | *.sco |
Cuda | cuda | *.cu |
Cycript | cycript | *.cy |
Cython | cython, pyrex | *.pyx |
D | d | *.d |
D-ObjDump | d-objdump | *.d-objdump |
DIGITAL Command Language | digital-command-language, dcl | *.com |
DM | dm, byond | *.dm |
DNS Zone | dns-zone | *.zone |
DTrace | dtrace, dtrace-script | *.d |
Dafny | dafny | *.dfy |
Darcs Patch | darcs-patch, dpatch | *.darcspatch |
Dart | dart | *.dart |
DataWeave | dataweave | *.dwl |
Dhall | dhall | *.dhall |
Diff | diff, udiff | *.diff |
DirectX 3D File | directx-3d-file | *.x |
Dockerfile | dockerfile | *.dockerfile, Dockerfile |
Dogescript | dogescript | *.djs |
Dylan | dylan | *.dylan |
E | e | *.E |
EBNF | ebnf | *.ebnf |
ECL | ecl | *.ecl |
ECLiPSe | eclipse | *.ecl |
EJS | ejs | *.ejs |
EML | eml | *.eml |
EQ | eq | *.eq |
Eagle | eagle | *.sch |
Easybuild | easybuild | *.eb |
Ecere Projects | ecere-projects | *.epj |
EditorConfig | editorconfig, editor-config | .editorconfig |
Edje Data Collection | edje-data-collection | *.edc |
Eiffel | eiffel | *.e |
Elixir | elixir | *.ex, mix.lock |
Elm | elm | *.elm |
Emacs Lisp | emacs-lisp, elisp, emacs | *.el, .abbrev_defs |
EmberScript | emberscript | *.em |
Erlang | erlang | *.erl, Emakefile |
F# | f#, fsharp | *.fs |
F* | f*, fstar | *.fst |
FIGlet Font | figlet-font, FIGfont | *.flf |
FLUX | flux | *.fx |
Factor | factor | *.factor, .factor-boot-rc |
Fancy | fancy | *.fy, Fakefile |
Fantom | fantom | *.fan |
Faust | faust | *.dsp |
Filebench WML | filebench-wml | *.f |
Filterscript | filterscript | *.fs |
Formatted | formatted | *.for |
Forth | forth | *.fth |
Fortran | fortran | *.f |
Fortran Free Form | fortran-free-form | *.f90 |
FreeMarker | freemarker, ftl | *.ftl |
Frege | frege | *.fr |
Futhark | futhark | *.fut |
G-code | g-code | *.g |
GAML | gaml | *.gaml |
GAMS | gams | *.gms |
GAP | gap | *.g |
GCC Machine Description | gcc-machine-description | *.md |
GDB | gdb | *.gdb |
GDScript | gdscript | *.gd |
GEDCOM | gedcom | *.ged |
GLSL | glsl | *.glsl |
GN | gn | *.gn, .gn |
Game Maker Language | game-maker-language | *.gml |
Genie | genie | *.gs |
Genshi | genshi, xml+genshi, xml+kid | *.kid |
Gentoo Ebuild | gentoo-ebuild | *.ebuild |
Gentoo Eclass | gentoo-eclass | *.eclass |
Gerber Image | gerber-image, rs-274x | *.gbr |
Gettext Catalog | gettext-catalog, pot | *.po |
Gherkin | gherkin, cucumber | *.feature |
Git Attributes | git-attributes, gitattributes | .gitattributes |
Git Config | git-config, gitconfig, gitmodules | *.gitconfig, .gitconfig |
Glyph | glyph | *.glf |
Glyph Bitmap Distribution Format | glyph-bitmap-distribution-format | *.bdf |
Gnuplot | gnuplot | *.gp |
Go | go, golang | *.go |
Golo | golo | *.golo |
Gosu | gosu | *.gs |
Grace | grace | *.grace |
Gradle | gradle | *.gradle |
Grammatical Framework | grammatical-framework, gf | *.gf |
Graph Modeling Language | graph-modeling-language | *.gml |
GraphQL | graphql | *.graphql |
Graphviz (DOT) | dot | *.dot |
Groovy | groovy | *.groovy, Jenkinsfile |
Groovy Server Pages | groovy-server-pages, gsp | *.gsp |
HAProxy | haproxy | *.cfg, haproxy.cfg |
HCL | hcl, terraform | *.hcl |
HLSL | hlsl | *.hlsl |
HTML | html, xhtml | *.html |
HTML+Django | html+django, django, html+jinja, htmldjango | *.jinja |
HTML+ECR | html+ecr, ecr | *.ecr |
HTML+EEX | html+eex, eex | *.eex |
HTML+ERB | html+erb, erb | *.erb |
HTML+PHP | html+php | *.phtml |
HTML+Razor | html+razor, razor | *.cshtml |
HTTP | http | *.http |
HXML | hxml | *.hxml |
Hack | hack | *.hack |
Haml | haml | *.haml |
Handlebars | handlebars, hbs, htmlbars | *.handlebars |
Harbour | harbour | *.hb |
Haskell | haskell | *.hs |
Haxe | haxe | *.hx |
HiveQL | hiveql | *.q |
HolyC | holyc | *.hc |
Hy | hy, hylang | *.hy |
HyPhy | hyphy | *.bf |
IDL | idl | *.pro |
IGOR Pro | igor-pro, igor, igorpro | *.ipf |
INI | ini, dosini | *.ini, buildozer.spec |
IRC log | irc-log, irc | *.irclog |
Idris | idris | *.idr |
Ignore List | ignore-list, ignore, gitignore, git-ignore | *.gitignore, .atomignore |
Inform 7 | inform-7, i7, inform7 | *.ni |
Inno Setup | inno-setup | *.iss |
Io | io | *.io |
Ioke | ioke | *.ik |
Isabelle | isabelle | *.thy |
Isabelle ROOT | isabelle-root | ROOT |
J | j | *.ijs |
JFlex | jflex | *.flex |
JSON | json | *.json, .arcconfig |
JSON with Comments | json-with-comments, jsonc | *.jsonc, .babelrc |
JSON5 | json5 | *.json5 |
JSONLD | jsonld | *.jsonld |
JSONiq | jsoniq | *.jq |
JSX | jsx | *.jsx |
Jasmin | jasmin | *.j |
Java | java | *.java |
Java Properties | java-properties | *.properties |
Java Server Pages | java-server-pages, jsp | *.jsp |
JavaScript | javascript, js, node | *.js, Jakefile |
JavaScript+ERB | javascript+erb | *.js.erb |
Jison | jison | *.jison |
Jison Lex | jison-lex | *.jisonlex |
Jolie | jolie | *.ol |
Jsonnet | jsonnet | *.jsonnet |
Julia | julia | *.jl |
Jupyter Notebook | jupyter-notebook | *.ipynb, Notebook |
KRL | krl | *.krl |
KiCad Layout | kicad-layout, pcbnew | *.kicad_pcb, fp-lib-table |
KiCad Legacy Layout | kicad-legacy-layout | *.brd |
KiCad Schematic | kicad-schematic | *.sch |
Kit | kit | *.kit |
Kotlin | kotlin | *.kt |
LFE | lfe | *.lfe |
LLVM | llvm | *.ll |
LOLCODE | lolcode | *.lol |
LSL | lsl | *.lsl |
LTspice Symbol | ltspice-symbol | *.asy |
LabVIEW | labview | *.lvproj |
Lasso | lasso, lassoscript | *.lasso |
Latte | latte | *.latte |
Lean | lean | *.lean |
Less | less | *.less |
Lex | lex, flex | *.l |
LilyPond | lilypond | *.ly |
Limbo | limbo | *.b |
Linker Script | linker-script | *.ld, ld.script |
Linux Kernel Module | linux-kernel-module | *.mod |
Liquid | liquid | *.liquid |
Literate Agda | literate-agda | *.lagda |
Literate CoffeeScript | literate-coffeescript, litcoffee | *.litcoffee |
Literate Haskell | literate-haskell, lhaskell, lhs | *.lhs |
LiveScript | livescript, live-script, ls | *.ls, Slakefile |
Logos | logos | *.xm |
Logtalk | logtalk | *.lgt |
LookML | lookml | *.lookml |
LoomScript | loomscript | *.ls |
Lua | lua | *.lua, .luacheckrc |
M | m, mumps | *.mumps |
M4 | m4 | *.m4 |
M4Sugar | m4sugar, autoconf | *.m4, configure.ac |
MATLAB | matlab, octave | *.matlab |
MAXScript | maxscript | *.ms |
MLIR | mlir | *.mlir |
MQL4 | mql4 | *.mq4 |
MQL5 | mql5 | *.mq5 |
MTML | mtml | *.mtml |
MUF | muf | *.muf |
Macaulay2 | macaulay2, m2 | *.m2 |
Makefile | makefile, bsdmake, make, mf | *.mak, BSDmakefile |
Mako | mako | *.mako |
Markdown | markdown, pandoc | *.md, contents.lr |
Marko | marko, markojs | *.marko |
Mask | mask | *.mask |
Mathematica | mathematica, mma | *.mathematica |
Maven POM | maven-pom | pom.xml |
Max | max, max/msp, maxmsp | *.maxpat |
MediaWiki | mediawiki | *.mediawiki |
Mercury | mercury | *.m |
Meson | meson | meson.build |
Metal | metal | *.metal |
Microsoft Developer Studio Project | microsoft-developer-studio-project | *.dsp |
MiniD | minid | *.minid |
Mirah | mirah | *.druby |
Modelica | modelica | *.mo |
Modula-2 | modula-2 | *.mod |
Modula-3 | modula-3 | *.i3 |
Module Management System | module-management-system | *.mms, descrip.mmk |
Monkey | monkey | *.monkey |
Moocode | moocode | *.moo |
MoonScript | moonscript | *.moon |
Motorola 68K Assembly | motorola-68k-assembly, m68k | *.asm |
Muse | muse, amusewiki | *.muse |
Myghty | myghty | *.myt |
NASL | nasl | *.nasl |
NCL | ncl | *.ncl |
NEON | neon, ne-on | *.neon |
NL | nl | *.nl |
NPM Config | npm-config, npmrc | .npmrc |
NSIS | nsis | *.nsi |
Nearley | nearley | *.ne |
Nemerle | nemerle | *.n |
NetLinx | netlinx | *.axs |
NetLinx+ERB | netlinx+erb | *.axs.erb |
NetLogo | netlogo | *.nlogo |
NewLisp | newlisp | *.nl |
Nextflow | nextflow | *.nf, nextflow.config |
Nginx | nginx | *.nginxconf, nginx.conf |
Nim | nim | *.nim, nim.cfg |
Ninja | ninja | *.ninja |
Nit | nit | *.nit |
Nix | nix, nixos | *.nix |
Nu | nu, nush | *.nu, Nukefile |
NumPy | numpy | *.numpy |
OCaml | ocaml | *.ml |
ObjDump | objdump | *.objdump |
Object Data Instance Notation | object-data-instance-notation | *.odin |
ObjectScript | objectscript | *.cls |
Objective-C | objective-c, obj-c, objc, objectivec | *.m |
Objective-C++ | objective-c++, obj-c++, objc++, objectivec++ | *.mm |
Objective-J | objective-j, obj-j, objectivej, objj | *.j |
Odin | odin, odinlang, odin-lang | *.odin |
Omgrofl | omgrofl | *.omgrofl |
Opa | opa | *.opa |
Opal | opal | *.opal |
Open Policy Agent | open-policy-agent | *.rego |
OpenCL | opencl | *.cl |
OpenEdge ABL | openedge-abl, progress, openedge, abl | *.p |
OpenQASM | openqasm | *.qasm |
OpenRC runscript | openrc-runscript, openrc | |
OpenSCAD | openscad | *.scad |
OpenStep Property List | openstep-property-list | *.plist |
OpenType Feature File | opentype-feature-file, AFDKO | *.fea |
Org | org | *.org |
Ox | ox | *.ox |
Oxygene | oxygene | *.oxygene |
Oz | oz | *.oz |
P4 | p4 | *.p4 |
PHP | php, inc | *.php, .php |
PLSQL | plsql | *.pls |
PLpgSQL | plpgsql | *.pgsql |
POV-Ray SDL | pov-ray-sdl, pov-ray, povray | *.pov |
Pan | pan | *.pan |
Papyrus | papyrus | *.psc |
Parrot | parrot | *.parrot |
Parrot Assembly | parrot-assembly, pasm | *.pasm |
Parrot Internal Representation | parrot-internal-representation, pir | *.pir |
Pascal | pascal | *.pas |
Pawn | pawn | *.pwn |
Pep8 | pep8 | *.pep |
Perl | perl, cperl | *.pl, Makefile.PL |
Pic | pic | *.pic |
Pickle | pickle | *.pkl |
PicoLisp | picolisp | *.l |
PigLatin | piglatin | *.pig |
Pike | pike | *.pike |
PlantUML | plantuml | *.puml |
Pod | pod | *.pod |
Pod 6 | pod-6 | *.pod |
PogoScript | pogoscript | *.pogo |
Pony | pony | *.pony |
PostCSS | postcss | *.pcss |
PostScript | postscript, postscr | *.ps |
PowerBuilder | powerbuilder | *.pbt |
PowerShell | powershell, posh, pwsh | *.ps1 |
Prisma | prisma | *.prisma |
Processing | processing | *.pde |
Proguard | proguard | *.pro |
Prolog | prolog | *.pl |
Propeller Spin | propeller-spin | *.spin |
Protocol Buffer | protocol-buffer, protobuf | *.proto |
Public Key | public-key | *.asc |
Pug | pug | *.jade |
Puppet | puppet | *.pp, Modulefile |
Pure Data | pure-data | *.pd |
PureBasic | purebasic | *.pb |
PureScript | purescript | *.purs |
Python | python, python3, rusthon | *.py, .gclient |
Python console | python-console, pycon | |
Python traceback | python-traceback | *.pytb |
QML | qml | *.qml |
QMake | qmake | *.pro |
Quake | quake | m3makefile |
R | r, R, Rscript, splus | *.r, .Rprofile |
RAML | raml | *.raml |
RDoc | rdoc | *.rdoc |
REALbasic | realbasic | *.rbbas |
REXX | rexx, arexx | *.rexx |
RHTML | rhtml, html+ruby | *.rhtml |
RMarkdown | rmarkdown | *.rmd |
RPC | rpc, rpcgen, oncrpc, xdr | *.x |
RPM Spec | rpm-spec, specfile | *.spec |
RUNOFF | runoff | *.rnh |
Racket | racket | *.rkt |
Ragel | ragel, ragel-rb, ragel-ruby | *.rl |
Raku | raku, perl6, perl-6 | *.6pl |
Rascal | rascal | *.rsc |
Raw token data | raw-token-data, raw | *.raw |
Readline Config | readline-config, inputrc, readline | .inputrc |
Reason | reason | *.re |
Rebol | rebol | *.reb |
Red | red, red/system | *.red |
Redcode | redcode | *.cw |
Regular Expression | regular-expression, regexp, regex | *.regexp |
Ren’Py | ren’py, renpy | *.rpy |
RenderScript | renderscript | *.rs |
Rich Text Format | rich-text-format | *.rtf |
Ring | ring | *.ring |
Riot | riot | *.riot |
RobotFramework | robotframework | *.robot |
Roff | roff, groff, mdoc, nroff, troff | *.roff, eqnrc |
Roff Manpage | roff-manpage | *.1 |
Rouge | rouge | *.rg |
Ruby | ruby, jruby, macruby, rake, rb, rbx | *.rb, .irbrc |
Rust | rust | *.rs |
SAS | sas | *.sas |
SCSS | scss | *.scss |
SMT | smt | *.smt2 |
SPARQL | sparql | *.sparql |
SQF | sqf | *.sqf |
SQL | sql | *.sql |
SQLPL | sqlpl | *.sql |
SRecode Template | srecode-template | *.srt |
SSH Config | ssh-config | ssh-config |
STON | ston | *.ston |
SVG | svg | *.svg |
SWIG | swig | *.i |
Sage | sage | *.sage |
SaltStack | saltstack, saltstate, salt | *.sls |
Sass | sass | *.sass |
Scala | scala | *.scala |
Scaml | scaml | *.scaml |
Scheme | scheme | *.scm |
Scilab | scilab | *.sci |
Self | self | *.self |
ShaderLab | shaderlab | *.shader |
Shell | shell, sh, shell-script, bash, zsh | *.sh, .bash_aliases |
ShellSession | shellsession, console | *.sh-session |
Shen | shen | *.shen |
Sieve | sieve | *.sieve |
Slash | slash | *.sl |
Slice | slice | *.ice |
Slim | slim | *.slim |
SmPL | smpl, coccinelle | *.cocci |
Smali | smali | *.smali |
Smalltalk | smalltalk, squeak | *.st |
Smarty | smarty | *.tpl |
Solidity | solidity | |
SourcePawn | sourcepawn, sourcemod | *.sp |
Spline Font Database | spline-font-database | *.sfd |
Squirrel | squirrel | *.nut |
Stan | stan | *.stan |
Standard ML | standard-ml, sml | *.ML |
Starlark | starlark, bazel, bzl | *.bzl, BUCK |
Stata | stata | *.do |
Stylus | stylus | *.styl |
SubRip Text | subrip-text | *.srt |
SugarSS | sugarss | *.sss |
SuperCollider | supercollider | *.sc |
Svelte | svelte | *.svelte |
Swift | swift | *.swift |
SystemVerilog | systemverilog | *.sv |
TI Program | ti-program | *.8xp |
TLA | tla | *.tla |
TOML | toml | *.toml, Cargo.lock |
TSQL | tsql | *.sql |
TSX | tsx | *.tsx |
TXL | txl | *.txl |
Tcl | tcl | *.tcl, owh |
Tcsh | tcsh | *.tcsh |
TeX | tex, latex | *.tex |
Tea | tea | *.tea |
Terra | terra | *.t |
Texinfo | texinfo | *.texinfo |
Text | text, fundamental | *.txt, COPYING |
Textile | textile | *.textile |
Thrift | thrift | *.thrift |
Turing | turing | *.t |
Turtle | turtle | *.ttl |
Twig | twig | *.twig |
Type Language | type-language, tl | *.tl |
TypeScript | typescript, ts | *.ts |
Unified Parallel C | unified-parallel-c | *.upc |
Unity3D Asset | unity3d-asset | *.anim |
Unix Assembly | unix-assembly | *.s |
Uno | uno | *.uno |
UnrealScript | unrealscript | *.uc |
UrWeb | urweb, Ur/Web, Ur | *.ur |
V | v, vlang | *.v |
VBA | vba, vb6 | *.bas |
VBScript | vbscript | *.vbs |
VCL | vcl | *.vcl |
VHDL | vhdl | *.vhdl |
Vala | vala | *.vala |
Verilog | verilog | *.v |
Vim Snippet | vim-snippet, SnipMate, UltiSnip, NeoSnippet | *.snip |
Vim script | vim-script, vim, viml, nvim | *.vim, .gvimrc |
Visual Basic .NET | vbnet, vb.net | *.vb |
Volt | volt | *.volt |
Vue | vue | *.vue |
Wavefront Material | wavefront-material | *.mtl |
Wavefront Object | wavefront-object | *.obj |
Web Ontology Language | web-ontology-language | *.owl |
WebAssembly | webassembly, wast, wasm | *.wast |
WebIDL | webidl | *.webidl |
WebVTT | webvtt | *.vtt |
Wget Config | wget-config, wgetrc | .wgetrc |
Windows Registry Entries | windows-registry-entries | *.reg |
Wollok | wollok | *.wlk |
World of Warcraft Addon Data | world-of-warcraft-addon-data | *.toc |
X BitMap | x-bitmap, xbm | *.xbm |
X Font Directory Index | x-font-directory-index | encodings.dir |
X PixMap | x-pixmap, xpm | *.xpm |
X10 | x10, xten | *.x10 |
XC | xc | *.xc |
XCompose | xcompose | .XCompose |
XML | xml, rss, xsd, wsdl | *.xml, .classpath |
XML Property List | xml-property-list | *.plist |
XPages | xpages | *.xsp-config |
XProc | xproc | *.xpl |
XQuery | xquery | *.xquery |
XS | xs | *.xs |
XSLT | xslt, xsl | *.xslt |
Xojo | xojo | *.xojo_code |
Xtend | xtend | *.xtend |
YAML | yaml, yml | *.yml, .clang-format |
YANG | yang | *.yang |
YARA | yara | *.yar |
YASnippet | yasnippet, snippet, yas | *.yasnippet |
Yacc | yacc | *.y |
ZAP | zap | *.zap |
ZIL | zil | *.zil |
Zeek | zeek, bro | *.zeek |
ZenScript | zenscript | *.zs |
Zephir | zephir | *.zep |
Zig | zig | *.zig |
Zimpl | zimpl | *.zimpl |
cURL Config | curl-config, curlrc | .curlrc |
desktop | desktop | *.desktop |
dircolors | dircolors | *.dircolors, .dir_colors |
eC | ec | *.ec |
edn | edn | *.edn |
fish | fish | *.fish |
mIRC Script | mirc-script | *.mrc |
mcfunction | mcfunction | *.mcfunction |
mupad | mupad | *.mu |
nanorc | nanorc | *.nanorc, .nanorc |
nesC | nesc | *.nc |
ooc | ooc | *.ooc |
q | q | *.q |
reStructuredText | restructuredtext, rst | *.rst |
sed | sed | *.sed |
wdl | wdl | *.wdl |
wisp | wisp | *.wisp |
xBase | xbase, advpl, clipper, foxpro | *.prg |
此表转自:Markdown 代码块编程语言清单
分隔线语法
有时你可能想要一条分割线来为你的文章划成不同部分,此时,你可以通过另起一行,并且这一行只输入三个星号
就像这样:
***
那么它呈现出来的效果应该是这样的:
列表语法
列表分为有序列表和无序列表,它可以将你的内容分成一条一条的,比如此时你想写几条规定,那么列表就是一个不错的选择,或者你想举几个例子,这时可以通过引用和列表
它们的语法如下:
1.有序列表
以数字1和句号(.
)开头,再输入一个空格,然后输入内容,再依次递增,就像这样:
- 这是有序列表示例一行
- 这是有序列表示例二行
- 这是有序列表示例三行
你会发现它和正常段落的缩进的格式不一样
2.无序列表
使用加号(+
)开头,再输入一个空格,然后输入内容,就像这样:
- 这是无序列表示例一行
- 这是无序列表示例二行
- 这是无序列表示例三行
你会发现无序列表的缩进也与正常段落的不同,而有序和无序之间的区别就是前面有没有数字序号,可以根据实际情况灵活选用一种
表格语法
聊完列表,再来说明一下另外一种常用的可选结构——表格
表格的用途有很多,你可以拿它来放很多东西,在Markdown中,表格的语法是这样的:
使用三个或更多减号(--
)创建每列的标题,并使用管道符(|
)分隔每列,此外,你可以给减号两侧添加冒号(:
)来实现不同的文字对齐效果,就像这样
| 第一天 | 第二天 | 第三天 |
| :--- | :----: | ---: |
| 开心 | 愤怒 | 难过 |
| 不开心 | 不愤怒 | 不难过 |
它实现出来的效果是这样的:
第一天 | 第二天 | 第三天 |
---|---|---|
开心 | 愤怒 | 难过 |
不开心 | 不愤怒 | 不难过 |
链接及注释语法
在写文章时可能需要给出一个跳转到其他网页的链接,或者有些词语你认为对读者来说有必要解释一下,也需要给它添加脚注、注释,就像通常的纸质书所做的那样,根据编号在页面下方查看相应的解释,这两种我认为从本质上都是链接,一个是页面外部跳转,一个是页面内部跳转而已。
它们的语法规则是这样的:
1.链接语法:
将链接文本放在中括号([]
)内,链接地址放在后面的括号(()
)中。
就像这样:[这是一个链接示例](www.baidu.com)
它呈现的效果是这样的:这是一个链接示例
此时你点击这个链接示例,你的浏览器应该会跳转到百度
2.脚注语法:
在文章中添加脚注编号,只需要使用方括号([]
),在其中输入一个插入符号(^
)和序号(一般是数字)即可,就像这样:[^1]
对于这个序号指向的具体内容,你需要使用对应的脚注编号,然后使用冒号(:),在后面输入对应的解释文本,就像这样:[^1]:这是一条脚注示例
它的呈现效果应该是这样的:
这是一段用于展示脚注语法1的示例
此时你将鼠标移动到1上时,可以看到对应的内容,点击1也可以跳转到脚注位置,一般解释都放在末尾
图片语法
对于一些简单的内容,单文本可能更易阅读,对于一些抽象或者复杂的内容来说,有时添加一张图片配合解释,也许会更容易让人看懂。
Markdown中,插入图片的语法是这样的:
先输入感叹号(!
),再输入方括号([]
),方括号中填写当图片无法正常加载时显示的信息,一般是图片内容,最后输入括号(()
),括号中输入图片的链接地址,就像这样
\![Markdown](/imgs/markdown.jpg)
那么它呈现的效果,和这篇文章的头图效果是一样的
转义字符语法
我们发现Markdown主要是通过使用一些符号来给文字加上样式,那如果想显示那些语法中用到的符号该怎么办呢?此时就用到了转义字符。
只需要在你想显示的符号前面加上一个反斜杠符号(\
)即可,加上这个反斜杠,原本会实现相应功能的符号,就会变成只显示那个符号样子。
总结
以上就是我认为Markdown中常用的知识点,希望能对你使用它写文章有所帮助。在我写这篇简单的Markdown教程时也熟悉了它的用法,可谓是一举两得,以上这些语法中使用的符号都应该使用英文半角符号,而不是中文全角符号,这样可以最大程度上避免出错。
参考资料
- Markdown官方教程:https://markdown.com.cn/
- Markdown指南中文版:https://www.markdown.xyz/
- Markdown Guide:https://www.markdownguide.org/
- 脚注语法就是这么神奇 ↩
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。