Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markdown那些事儿 #237

Open
FrankKai opened this issue Oct 19, 2020 · 0 comments
Open

markdown那些事儿 #237

FrankKai opened this issue Oct 19, 2020 · 0 comments

Comments

@FrankKai
Copy link
Owner

主要用来记录一些常用的markdown片段或者说知识点。

  • 使用 ```<language type?:?String>...code...``` 时如何高亮代码块?
  • latex语法换行如何对齐?
  • 如何在markdown中折叠答案?

使用 ```<language type?:?String>...code...``` 时如何高亮代码块?

目前已知的是可以用javascript,java高亮代码,其余的语言呢?

var foo = 1;

```javascript
const foo = "hi girl";
console.log(foo); // "hi girl"
```

如果想知道其他语言怎么高亮,请看下面这个神级链接:https://github.com/github/linguist/blob/master/lib/linguist/languages.yml

为什么可以用js来代表javascript呢?

JavaScript:
  type: programming
  tm_scope: source.js
  ace_mode: javascript
  codemirror_mode: javascript
  codemirror_mime_type: text/javascript
  color: "#f1e05a"
  aliases:
  - js
  - node
  extensions:
  - ".js"
  - "._js"
  - ".bones"
  - ".es"
  - ".es6"
  - ".frag"
  - ".gs"
  - ".jake"
  - ".jsb"
  - ".jscad"
  - ".jsfl"
  - ".jsm"
  - ".jss"
  - ".mjs"
  - ".njs"
  - ".pac"
  - ".sjs"
  - ".ssjs"
  - ".xsjs"
  - ".xsjslib"
  filenames:
  - Jakefile
  interpreters:
  - chakra
  - d8
  - js
  - node
  - rhino
  - v8
  - v8-shell
  language_id: 183

因为是aliases中包括js和node两种,所以可以被解释为javascript。

至于为什么大小写不区分不清楚,javascript、JavaScript、Javascript,甚至javASCRIPT都可以被解析为高亮,我推断是会把所有的字母lowercase化,也就是全部转换成小写。

至于其他的一些属性,我们不做关心。

参考资料:https://help.github.com/en/articles/creating-and-highlighting-code-blocks

markdown latex语法换行对齐

Mardown数学公式(Latex公式)语法中的&

无独有偶, Latex公式语法中换行时也是用 & 来表示的。

$$ \begin{align*}
result &=(x+y)^2 \\ 
&= x^2+2xy+y^2 
\end{align*} $$

typora支持Latex语法:
image

如何在markdown中折叠答案?

<details>
    <summary>答案标题</summary>
     <p>答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容</p>
</details>

效果如下:

答案标题

答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容答案内容

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant