mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
add Markdown guide
This commit is contained in:
parent
d01996288f
commit
2e7590de24
139
src/resources/docs/markdown_guide_en.md
Normal file
139
src/resources/docs/markdown_guide_en.md
Normal file
@ -0,0 +1,139 @@
|
||||
# Markdown Guide
|
||||
This is a quick guide [^1] for Markdown, a lightweight and easy-to-use syntax for writing.
|
||||
|
||||
## What is Markdown?
|
||||
Markdown is a way to style text via a few simple marker characters. You could write the document in plain text and then read it with a beautiful typesetting.
|
||||
|
||||
There is no a standard Markdown syntax and many editor will add its own additional syntax. VNote supports only the widely-used basic syntax.
|
||||
|
||||
## How to Use Markdown?
|
||||
If you are new to Markdown, it is better to learn the syntax elements step by step. Knowing headers and emphasis is enough to make you survive. You could learn another new syntax and practise it every one or two days.
|
||||
|
||||
## Syntax Guide
|
||||
Here is an overview of Markdown syntax supported by VNote.
|
||||
|
||||
### Headers
|
||||
```md
|
||||
# This is an <h1> tag
|
||||
## This is an <h2> tag
|
||||
###### This is an <h6> tag
|
||||
```
|
||||
|
||||
**Notes**:
|
||||
|
||||
- At least one space is needed after the `#`;
|
||||
- A header should occupy one entire line;
|
||||
|
||||
### Emphasis
|
||||
```md
|
||||
*This text will be italic*
|
||||
_This text will be italic_
|
||||
|
||||
**This text will be bold**
|
||||
__This text will be bold__
|
||||
```
|
||||
|
||||
**Notes**:
|
||||
|
||||
- `*` is recommended in VNote;
|
||||
- If the render failed, try to add an additional space before the first `*` and after the last `*`. The space is necessary if the surrounded text begins or ends with full width punctuation;
|
||||
- VNote provides shortcuts `Ctrl+I` and `Ctrl+B` to insert italic and bold text;
|
||||
|
||||
### Lists
|
||||
#### Unordered
|
||||
```md
|
||||
* Item 1
|
||||
This is a text under Item 1. Notice that there are two spaces at the end above.
|
||||
* Item 2
|
||||
* Item 2a
|
||||
* Item 2b
|
||||
* Item 3
|
||||
|
||||
To end a list, there should be one empty line above.
|
||||
```
|
||||
|
||||
#### Ordered
|
||||
```md
|
||||
1. Item 1
|
||||
1. Item 2
|
||||
Notice that the sequence number is irrelevant. Markdown will change the sequence automatically when renderring.
|
||||
3. Item 3
|
||||
1. Item 3a
|
||||
2. Item 3b
|
||||
4. Item 4
|
||||
```
|
||||
|
||||
### Images and Links
|
||||
```md
|
||||

|
||||
|
||||
[Link Text](/url/of/the/link)
|
||||
```
|
||||
|
||||
### Blockquotes
|
||||
```md
|
||||
As VNote suggests:
|
||||
|
||||
> VNote is the best Markdown note-taking application
|
||||
> ever.
|
||||
>
|
||||
> THere is two spaces after `ever.` above to insert a
|
||||
> new line.
|
||||
```
|
||||
|
||||
**Notes**:
|
||||
|
||||
- Space is needed after the marker `>`;
|
||||
- You could just add only one `>` at the first line;
|
||||
|
||||
### Fenced Code Block
|
||||
```lang
|
||||
This is a fenced code block.
|
||||
```
|
||||
|
||||
**Notes**:
|
||||
|
||||
- `lang` is optional to specify the language of the code;
|
||||
|
||||
### Inline Code
|
||||
```md
|
||||
Here is a `inline code`.
|
||||
```
|
||||
|
||||
### Strikethrough
|
||||
```md
|
||||
Here is a ~~text~~ with strikethrough.
|
||||
```
|
||||
|
||||
**Notes**:
|
||||
|
||||
- VNote provides shortcuts `Ctrl+D` to insert text with strikethrough;
|
||||
|
||||
### Task Lists
|
||||
```md
|
||||
- [x] this is a complete item.
|
||||
- [ ] this is an incomplete item.
|
||||
```
|
||||
|
||||
### Subscript and Superscript
|
||||
```md
|
||||
This is a text with subscript H~2~o.
|
||||
|
||||
This is a text with superscript 29^th^.
|
||||
```
|
||||
|
||||
### Footnote
|
||||
```md
|
||||
This is a footnote [^1].
|
||||
|
||||
[^1]: Here is the detail of the footnote.
|
||||
```
|
||||
|
||||
### New Line and Paragraph
|
||||
If you want to enter a new line, you should add two spaces after current line and then continue your input. VNote provides `Shift+Enter` to help.
|
||||
|
||||
If you want to enter a new paragraph, you should add an empty line and then continue entering the new paragraph.
|
||||
|
||||
Generally, you need to add an empty line after a block element (such as code block, lists, blockquote) to explicitly end it.
|
||||
|
||||
[^1]: This guide references [Mastering Markdown](https://guides.github.com/features/mastering-markdown/).
|
140
src/resources/docs/markdown_guide_zh.md
Normal file
140
src/resources/docs/markdown_guide_zh.md
Normal file
@ -0,0 +1,140 @@
|
||||
# Markdown指南
|
||||
Markdown是一种轻量级的易用的书写语法。本文是Markdown的一个快速指南[^1]。
|
||||
|
||||
## 什么是Markdown?
|
||||
Markdown是一种通过少量简单的标记字符来格式化文本的方法。您可以用纯文本来书写文档,然后在阅读时呈现一个美观的排版。
|
||||
|
||||
其实并没有一个标准的Markdown语法,很多编辑器都会添加自己的扩展语法。不同于此,为了兼容性,VNote仅仅支持那些被广泛使用的基本语法。
|
||||
|
||||
## 如何上手Markdown?
|
||||
如果您是刚接触Markdown,那么比较好的一个方法是逐个学习Markdown语法。刚开始,懂得标题和强调语法就能够写出基本的文档;然后,每天可以学习一个新的语法并不断练习。
|
||||
|
||||
|
||||
## 语法指南
|
||||
下面是VNote支持的Markdown语法的一个概览。
|
||||
|
||||
### 标题
|
||||
```md
|
||||
# This is an <h1> tag
|
||||
## This is an <h2> tag
|
||||
###### This is an <h6> tag
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
- `#`之后需要至少一个空格;
|
||||
- 一个标题应该占一整行;
|
||||
|
||||
### 强调
|
||||
```md
|
||||
*This text will be italic*
|
||||
_This text will be italic_
|
||||
|
||||
**This text will be bold**
|
||||
__This text will be bold__
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
- VNote推荐使用`*`;
|
||||
- 如果渲染错误,请尝试在第一个`*`之前以及最后一个`*`之后添加一个空格。如果被标记的文本是以全角符号开始或结尾,一般都需要前后添加一个空格;
|
||||
- VNote提供快捷键`Ctrl+I`和`Ctrl+B`来插入斜体和粗体;
|
||||
|
||||
### 列表
|
||||
#### 无序列表
|
||||
```md
|
||||
* Item 1
|
||||
只是一段在Item 1下面的文字。需要注意上面一行结尾有两个空格。
|
||||
* Item 2
|
||||
* Item 2a
|
||||
* Item 2b
|
||||
* Item 3
|
||||
|
||||
使用一个空行来来结束一个列表。
|
||||
```
|
||||
|
||||
#### 有序列表
|
||||
```md
|
||||
1. Item 1
|
||||
1. Item 2
|
||||
注意,列表前面的序号其实是无关紧要的,渲染时Markdown会自动修改该序号。
|
||||
3. Item 3
|
||||
1. Item 3a
|
||||
2. Item 3b
|
||||
4. Item 4
|
||||
```
|
||||
|
||||
### 图片和链接
|
||||
```md
|
||||

|
||||
|
||||
[Link Text](/url/of/the/link)
|
||||
```
|
||||
|
||||
### 块引用
|
||||
```md
|
||||
As VNote suggests:
|
||||
|
||||
> VNote is the best Markdown note-taking application
|
||||
> ever.
|
||||
>
|
||||
> THere is two spaces after `ever.` above to insert a
|
||||
> new line.
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
- `>`标记后面需要至少一个空格;
|
||||
- 多行连续的引用可以只在第一行添加标记;
|
||||
|
||||
### 代码块
|
||||
```lang
|
||||
This is a fenced code block.
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
- `lang`用于指定代码块的代码语言,可选;
|
||||
|
||||
### 行内代码
|
||||
```md
|
||||
Here is a `inline code`.
|
||||
```
|
||||
|
||||
### 删除线
|
||||
```md
|
||||
Here is a ~~text~~ with strikethrough.
|
||||
```
|
||||
|
||||
**注意**:
|
||||
|
||||
- VNote提供快捷键`Ctrl+D`来插入带有删除线的文本;
|
||||
|
||||
### 任务列表
|
||||
```md
|
||||
- [x] this is a complete item.
|
||||
- [ ] this is an incomplete item.
|
||||
```
|
||||
|
||||
### 上标和下标
|
||||
```md
|
||||
This is a text with subscript H~2~o.
|
||||
|
||||
This is a text with superscript 29^th^.
|
||||
```
|
||||
|
||||
### 脚注
|
||||
```md
|
||||
This is a footnote [^1].
|
||||
|
||||
[^1]: Here is the detail of the footnote.
|
||||
```
|
||||
|
||||
### 换行和段落
|
||||
如果需要换行,您应该在当前行末尾添加两个空格,然后换行。VNote提供快捷键`Shift+Enter`来辅助用户输入两个空格并换行。
|
||||
|
||||
如果需要一个新的段落,您应该先插入一个空行然后才输入新的段落的文本。
|
||||
|
||||
一般来说,您应该在一个块元素(例如代码块、列表和块引用)后面插入一个空行来显式结束该元素。
|
||||
|
||||
[^1]: 该指南参考了 [Mastering Markdown](https://guides.github.com/features/mastering-markdown/).
|
@ -443,10 +443,25 @@ void VMainWindow::initHelpMenu()
|
||||
connect(shortcutAct, &QAction::triggered,
|
||||
this, &VMainWindow::shortcutHelp);
|
||||
|
||||
QAction *mdGuideAct = new QAction(tr("&Markdown Guide"), this);
|
||||
mdGuideAct->setToolTip(tr("A quick guide of Markdown syntax"));
|
||||
connect(mdGuideAct, &QAction::triggered,
|
||||
this, [this](){
|
||||
QString locale = VUtils::getLocale();
|
||||
QString docName = VNote::c_markdownGuideDocFile_en;
|
||||
if (locale == "zh_CN") {
|
||||
docName = VNote::c_markdownGuideDocFile_zh;
|
||||
}
|
||||
|
||||
VFile *file = vnote->getOrphanFile(docName, false, true);
|
||||
(dynamic_cast<VOrphanFile *>(file))->setNotebookName(tr("[Help]"));
|
||||
editArea->openFile(file, OpenFileMode::Read);
|
||||
});
|
||||
|
||||
QAction *updateAct = new QAction(tr("Check For &Updates"), this);
|
||||
updateAct->setToolTip(tr("Check for updates of VNote"));
|
||||
connect(updateAct, &QAction::triggered,
|
||||
this, [this]() {
|
||||
this, [this](){
|
||||
VUpdater updater(this);
|
||||
updater.exec();
|
||||
});
|
||||
@ -479,14 +494,16 @@ void VMainWindow::initHelpMenu()
|
||||
connect(aboutQtAct, &QAction::triggered,
|
||||
qApp, &QApplication::aboutQt);
|
||||
|
||||
helpMenu->addAction(shortcutAct);
|
||||
helpMenu->addAction(mdGuideAct);
|
||||
helpMenu->addAction(updateAct);
|
||||
helpMenu->addAction(starAct);
|
||||
helpMenu->addAction(feedbackAct);
|
||||
|
||||
#if defined(QT_NO_DEBUG)
|
||||
helpMenu->addAction(logAct);
|
||||
#endif
|
||||
|
||||
helpMenu->addAction(shortcutAct);
|
||||
helpMenu->addAction(updateAct);
|
||||
helpMenu->addAction(starAct);
|
||||
helpMenu->addAction(feedbackAct);
|
||||
helpMenu->addAction(aboutQtAct);
|
||||
helpMenu->addAction(aboutAct);
|
||||
}
|
||||
|
@ -48,6 +48,9 @@ const QString VNote::c_mathjaxJsFile = "https://cdn.mathjax.org/mathjax/latest/M
|
||||
const QString VNote::c_shortcutsDocFile_en = ":/resources/docs/shortcuts_en.md";
|
||||
const QString VNote::c_shortcutsDocFile_zh = ":/resources/docs/shortcuts_zh.md";
|
||||
|
||||
const QString VNote::c_markdownGuideDocFile_en = ":/resources/docs/markdown_guide_en.md";
|
||||
const QString VNote::c_markdownGuideDocFile_zh = ":/resources/docs/markdown_guide_zh.md";
|
||||
|
||||
VNote::VNote(QObject *parent)
|
||||
: QObject(parent), m_mainWindow(dynamic_cast<VMainWindow *>(parent))
|
||||
{
|
||||
|
@ -67,6 +67,9 @@ public:
|
||||
static const QString c_shortcutsDocFile_en;
|
||||
static const QString c_shortcutsDocFile_zh;
|
||||
|
||||
static const QString c_markdownGuideDocFile_en;
|
||||
static const QString c_markdownGuideDocFile_zh;
|
||||
|
||||
const QVector<QPair<QString, QString> > &getPalette() const;
|
||||
void initPalette(QPalette palette);
|
||||
QString getColorFromPalette(const QString &p_name) const;
|
||||
|
@ -118,5 +118,7 @@
|
||||
<file>resources/icons/close_note_tb.svg</file>
|
||||
<file>resources/icons/32x32/vnote.png</file>
|
||||
<file>resources/icons/editing_modified.svg</file>
|
||||
<file>resources/docs/markdown_guide_en.md</file>
|
||||
<file>resources/docs/markdown_guide_zh.md</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
x
Reference in New Issue
Block a user