本页面详细介绍了 Markdown Here 的主要功能与特性,阐述了此扩展的功能以及它如何改变您的 Markdown 写作体验。有关安装说明,请参阅安装与设置。有关支持的浏览器和平台信息,请参阅支持的平台。
下图展示了 Markdown Here 的主要功能及其与代码组件的关系
来源:README.md src/common/markdown-render.js src/common/marked.js
Markdown Here 全面支持 Markdown 语法,让您能够轻松编写结构化内容。
Markdown Here 支持以下标准 Markdown 语法:
| 元素 | 语法 | 渲染为 |
|---|---|---|
| 头 | # H1, ## H2, 等。 | H1,H2,等等。 |
| 强调 | *italic*, **bold** | italic, bold |
| 列表 | - item, 1. item | 无序列表、有序列表 |
| 链接 | <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/text" undefined file-path="text">Hii</FileRef> | 可点击链接 |
| 图像 | !<FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/alt" undefined file-path="alt">Hii</FileRef> | 嵌入式图片 |
| 引用块 | > quote | 缩进引用块 |
| 代码 | `code` | 行内代码 |
| 代码块 | 语言 | 语法高亮代码块 |
来源:src/common/marked.js README.md93-100
Markdown Here 实现了 GitHub Flavored Markdown,包括:
~~strikethrough~~ 实现删除线可以在设置中通过 GFM 换行符选项启用或禁用换行符。
来源:src/common/markdown-render.js77-82 README.md162
下图说明了 Markdown 如何被处理和渲染:
来源:src/common/markdown-render.js28-101 src/common/test/markdown-render-test.js
Markdown Here 使用 highlight.js 库为代码块提供丰富的语法高亮显示。
当您指定语言时,代码块会自动高亮显示
```javascript
function example() {
return "This would be highlighted as JavaScript";
}
A wide range of languages are supported, including:
- JavaScript, HTML, CSS
- Python, Ruby, PHP
- Java, C, C++, C#
- SQL, Bash, YAML, JSON
- And many more
You can see the full list of available languages on the [highlight.js demo page](https://highlightjs.org/demo) as mentioned in the README.
### Syntax Themes
Multiple syntax highlighting themes are available, similar to popular code editors. You can select your preferred theme in the options page.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/README.md#L164-L164" min=164 file-path="README.md">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/markdown-render.js#L83-L96" min=83 max=96 file-path="src/common/markdown-render.js">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L213-L219" min=213 max=219 file-path="src/common/CHANGES.md">Hii</FileRef>
## Mathematical Formula Support
Markdown Here renders TeX mathematical formulas using a configurable rendering service:
- Inline math: Write formulas between single dollar signs `$formula$`
- Block math: Write formulas between double dollar signs `$$formula$$`
The math rendering is powered by CodeCogs (as of v2.14.2) and can be enabled or disabled in the options.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/markdown-render.js#L29-L33" min=29 max=33 file-path="src/common/markdown-render.js">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/test/markdown-render-test.js#L85-L100" min=85 max=100 file-path="src/common/test/markdown-render-test.js">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L14-L16" min=14 max=16 file-path="src/common/CHANGES.md">Hii</FileRef>
## Smart Formatting Features
### Smart Typography
Markdown Here automatically converts:
- Straight quotes to "curly quotes"
- Multiple hyphens to em-dashes (--) and en-dashes
- Three dots to an ellipsis (...)
### Smart Arrows
Arrow notation is automatically converted to arrow characters:
| You type | It becomes |
|----------|------------|
| `<-->` | ↔ |
| `<--` | ← |
| `-->` | → |
| `<==>` | ⇔ |
| `<==` | ⇐ |
| `==>` | ⇒ |
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/marked.js#L722-L745" min=722 max=745 file-path="src/common/marked.js">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L278-L285" min=278 max=285 file-path="src/common/CHANGES.md">Hii</FileRef>
## Customization Options
Markdown Here offers extensive customization options through its options page:
### Styling Customization
You can customize:
- Primary styling CSS (controls the appearance of rendered Markdown)
- Syntax highlighting themes
- Math rendering settings (enabled/disabled, rendering service)
- Site-specific styles
The CSS can be reset to defaults if needed.
### Configuration Options
Additional configurable features include:
- Header anchors (automatic linking to section headers)
- GFM line breaks (enable/disable line breaks)
- Forgot-to-render check (warn before sending raw Markdown)
- Keyboard shortcut (default is <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>M</kbd>)
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/README.md#L136-L147" min=136 max=147 file-path="README.md">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/default.css" undefined file-path="src/common/default.css">Hii</FileRef>
## Advanced Features
### Forgot-to-Render Check
This safety feature detects when you might be about to send an email with unrendered Markdown and warns you. It's especially helpful for preventing accidental sending of raw Markdown. This feature is supported in Thunderbird, and for Gmail in Chrome, Firefox, Opera, and Safari.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L295-L307" min=295 max=307 file-path="src/common/CHANGES.md">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L327-L330" min=327 max=330 file-path="src/common/CHANGES.md">Hii</FileRef>
### Header Anchors
When enabled, this feature automatically adds HTML anchors to headers, making it easy to create a table of contents with links to different sections in your document.
跳转到章节 <- 此链接将跳转到标题
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/markdown-render.js#L38-L56" min=38 max=56 file-path="src/common/markdown-render.js">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L340-L348" min=340 max=348 file-path="src/common/CHANGES.md">Hii</FileRef>
### Automatic Link Schema Addition
When you write a link without specifying the protocol (like `<FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/Link" undefined file-path="Link">Hii</FileRef>`), Markdown Here automatically adds `https://` to ensure the link works correctly.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/markdown-render.js#L59-L64" min=59 max=64 file-path="src/common/markdown-render.js">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/test/markdown-render-test.js#L54-L58" min=54 max=58 file-path="src/common/test/markdown-render-test.js">Hii</FileRef>
### Email Signature Handling
Markdown Here automatically excludes email signatures (text after the '-- ' marker) from conversion, preserving your signature formatting.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/README.md#L168-L169" min=168 max=169 file-path="README.md">Hii</FileRef>
### Revert to Markdown
After rendering your Markdown to HTML, you can revert back to the original Markdown for editing by clicking the "Markdown Toggle" button again. This works even after saving drafts in email clients or notes in Evernote.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/README.md#L106-L111" min=106 max=111 file-path="README.md">Hii</FileRef> <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/src/common/CHANGES.md#L227-L230" min=227 max=230 file-path="src/common/CHANGES.md">Hii</FileRef>
### Selection/Piecemeal Conversion
You can selectively convert only parts of your text by selecting the desired portion before clicking "Markdown Toggle". This is useful in emails where you might want to mix regular text with Markdown-formatted sections.
Sources: <FileRef file-url="https://github.com/adam-p/markdown-here/blob/a7dd5c56/README.md#L120-L134" min=120 max=134 file-path="README.md">Hii</FileRef>
## Code-to-Feature Mapping
The following diagram shows how user actions map directly to specific code functions:
```mermaid
graph TD
userAction["User clicks 'Markdown Toggle'"] --> mdHereTrigger["markdown-here.js: markdownHere.toggle()"]
mdHereTrigger --> isAlreadyRendered{"markdown-here.js: Check if already rendered"}
isAlreadyRendered -->|"No"| mdHTMLToText["mdh-html-to-text.js: MdhHtmlToText.get()"]
mdHTMLToText --> mdRender["markdown-render.js: MarkdownRender.markdownRender()"]
mdRender --> markedParser["marked.js: marked()"]
mdRender --> highlightFunction["markdown-render.js: highlight() callback"]
mdRender --> mathifyFunction["markdown-render.js: mathify()"]
markedParser --> markedOptions["markedOptions: gfm, tables, breaks, etc."]
highlightFunction --> highlightJS["highlight.js: highlight()"]
isAlreadyRendered -->|"Yes"| extractOriginal["mdh-html-to-text.js: Find original Markdown"]
mdRender --> renderResult["Rendered HTML"]
extractOriginal --> originalMD["Original Markdown"]
来源:src/common/markdown-render.js28-101 src/common/test/markdown-render-test.js
Markdown Here 的界面支持多种语言,包括:
Markdown Here 兼容多种平台:
有关更详细的兼容性信息,请参阅支持的平台。
刷新此 Wiki
最后索引时间2025 年 4 月 18 日(a7dd5c)