From 367a3329fd2d6e20454f19b6197fe75d4679865f Mon Sep 17 00:00:00 2001 From: ChiChen <2531693734@qq.com> Date: Wed, 11 Oct 2023 23:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=BA=86=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/.vuepress/config.ts | 6 +- src/.vuepress/navbar/en.ts | 74 ++- src/.vuepress/navbar/zh.ts | 15 +- src/.vuepress/sidebar/en.ts | 10 +- src/.vuepress/sidebar/zh.ts | 8 - src/.vuepress/theme.ts | 12 +- src/README.md | 4 +- src/demo/README.md | 17 - src/demo/disable.md | 42 -- src/demo/encrypt.md | 15 - src/demo/markdown.md | 423 --------------- src/demo/page.md | 74 --- src/posts/apple/1.md | 484 ------------------ src/posts/apple/2.md | 25 - src/posts/apple/3.md | 21 - src/posts/apple/4.md | 21 - src/posts/banana/1.md | 21 - src/posts/banana/2.md | 26 - src/posts/banana/3.md | 20 - src/posts/banana/4.md | 20 - src/posts/cherry.md | 20 - src/posts/dragonfruit.md | 20 - src/posts/strawberry.md | 20 - src/posts/template.md | 18 + src/posts/tomato.md | 22 - src/slides.md | 433 ---------------- src/zh/README.md | 49 +- src/zh/demo/README.md | 17 - src/zh/demo/disable.md | 42 -- src/zh/demo/encrypt.md | 15 - src/zh/demo/markdown.md | 403 --------------- src/zh/demo/page.md | 74 --- src/zh/posts/banana/1.md | 21 - src/zh/posts/banana/2.md | 26 - src/zh/posts/banana/3.md | 20 - src/zh/posts/banana/4.md | 20 - src/zh/posts/cherry.md | 20 - src/zh/posts/dragonfruit.md | 20 - src/zh/posts/strawberry.md | 20 - src/zh/posts/template.md | 19 + src/zh/posts/tomato.md | 22 - .../Chapter0 \345\211\215\350\250\200.md" | 14 +- ...21\345\231\250\347\273\204\346\210\220.md" | 15 +- ...15\346\263\225\345\210\206\346\236\220.md" | 15 +- ...55\346\263\225\345\210\206\346\236\220.md" | 15 +- ...55\344\271\211\345\210\206\346\236\220.md" | 15 +- ...43\347\240\201\347\224\237\346\210\220.md" | 15 +- src/zh/slides.md | 429 ---------------- 48 files changed, 179 insertions(+), 2998 deletions(-) delete mode 100644 src/demo/README.md delete mode 100644 src/demo/disable.md delete mode 100644 src/demo/encrypt.md delete mode 100644 src/demo/markdown.md delete mode 100644 src/demo/page.md delete mode 100644 src/posts/apple/1.md delete mode 100644 src/posts/apple/2.md delete mode 100644 src/posts/apple/3.md delete mode 100644 src/posts/apple/4.md delete mode 100644 src/posts/banana/1.md delete mode 100644 src/posts/banana/2.md delete mode 100644 src/posts/banana/3.md delete mode 100644 src/posts/banana/4.md delete mode 100644 src/posts/cherry.md delete mode 100644 src/posts/dragonfruit.md delete mode 100644 src/posts/strawberry.md create mode 100644 src/posts/template.md delete mode 100644 src/posts/tomato.md delete mode 100644 src/slides.md delete mode 100644 src/zh/demo/README.md delete mode 100644 src/zh/demo/disable.md delete mode 100644 src/zh/demo/encrypt.md delete mode 100644 src/zh/demo/markdown.md delete mode 100644 src/zh/demo/page.md delete mode 100644 src/zh/posts/banana/1.md delete mode 100644 src/zh/posts/banana/2.md delete mode 100644 src/zh/posts/banana/3.md delete mode 100644 src/zh/posts/banana/4.md delete mode 100644 src/zh/posts/cherry.md delete mode 100644 src/zh/posts/dragonfruit.md delete mode 100644 src/zh/posts/strawberry.md create mode 100644 src/zh/posts/template.md delete mode 100644 src/zh/posts/tomato.md delete mode 100644 src/zh/slides.md diff --git a/src/.vuepress/config.ts b/src/.vuepress/config.ts index ef1c75583..913ebac4d 100644 --- a/src/.vuepress/config.ts +++ b/src/.vuepress/config.ts @@ -7,12 +7,12 @@ export default defineUserConfig({ locales: { "/": { lang: "en-US", - title: "Blog Demo", - description: "A blog demo for vuepress-theme-hope", + title: "ChiChen's Blog", + description: "A blog of a", }, "/zh/": { lang: "zh-CN", - title: "博客演示", + title: "ChiChen's Blog", description: "vuepress-theme-hope 的博客演示", }, }, diff --git a/src/.vuepress/navbar/en.ts b/src/.vuepress/navbar/en.ts index cc8ff7174..ffef9ad11 100644 --- a/src/.vuepress/navbar/en.ts +++ b/src/.vuepress/navbar/en.ts @@ -2,51 +2,45 @@ import { navbar } from "vuepress-theme-hope"; export const enNavbar = navbar([ "/", - { text: "Demo", icon: "discover", link: "/demo/" }, { text: "Posts", icon: "edit", prefix: "/posts/", children: [ - { - text: "Apple", - icon: "edit", - prefix: "apple/", - children: [ - { text: "Apple1", icon: "edit", link: "1" }, - { text: "Apple2", icon: "edit", link: "2" }, - "3", - "4", - ], - }, - { - text: "Banana", - icon: "edit", - prefix: "banana/", - children: [ - { - text: "Banana 1", - icon: "edit", - link: "1", - }, - { - text: "Banana 2", - icon: "edit", - link: "2", - }, - "3", - "4", - ], - }, - { text: "Cherry", icon: "edit", link: "cherry" }, - { text: "Dragon Fruit", icon: "edit", link: "dragonfruit" }, - "tomato", - "strawberry", + // { + // text: "Apple", + // icon: "edit", + // prefix: "apple/", + // children: [ + // { text: "Apple1", icon: "edit", link: "1" }, + // { text: "Apple2", icon: "edit", link: "2" }, + // "3", + // "4", + // ], + // }, + // { + // text: "Banana", + // icon: "edit", + // prefix: "banana/", + // children: [ + // { + // text: "Banana 1", + // icon: "edit", + // link: "1", + // }, + // { + // text: "Banana 2", + // icon: "edit", + // link: "2", + // }, + // "3", + // "4", + // ], + // }, + // { text: "Cherry", icon: "edit", link: "cherry" }, + // { text: "Dragon Fruit", icon: "edit", link: "dragonfruit" }, + // "tomato", + // "strawberry", ], }, - { - text: "V2 Docs", - icon: "note", - link: "https://theme-hope.vuejs.press/", - }, ]); diff --git a/src/.vuepress/navbar/zh.ts b/src/.vuepress/navbar/zh.ts index 9738eaeb8..120c7b15e 100644 --- a/src/.vuepress/navbar/zh.ts +++ b/src/.vuepress/navbar/zh.ts @@ -27,22 +27,13 @@ export const zhNavbar = navbar([ children: [ { text: "震惊,1=0!?", - icon: "edit", + icon: "page", link: "编程杂谈/震惊,1=0!?.md", }, - { - text: "香蕉 2", - icon: "edit", - link: "2", - }, - "3", - "4", + ], }, - { text: "樱桃", icon: "edit", link: "cherry" }, - { text: "火龙果", icon: "edit", link: "dragonfruit" }, - "tomato", - "strawberry", + ], }, { diff --git a/src/.vuepress/sidebar/en.ts b/src/.vuepress/sidebar/en.ts index afe01bb58..ff69fabf7 100644 --- a/src/.vuepress/sidebar/en.ts +++ b/src/.vuepress/sidebar/en.ts @@ -3,20 +3,12 @@ import { sidebar } from "vuepress-theme-hope"; export const enSidebar = sidebar({ "/": [ "", - { - icon: "discover", - text: "Demo", - prefix: "demo/", - link: "demo/", - children: "structure", - }, { text: "Articles", icon: "note", prefix: "posts/", children: "structure", }, - "intro", - "slides", + "intro", ], }); diff --git a/src/.vuepress/sidebar/zh.ts b/src/.vuepress/sidebar/zh.ts index 28b259f93..fb0076c7e 100644 --- a/src/.vuepress/sidebar/zh.ts +++ b/src/.vuepress/sidebar/zh.ts @@ -3,13 +3,6 @@ import { sidebar } from "vuepress-theme-hope"; export const zhSidebar = sidebar({ "/zh/": [ "", - { - text: "如何使用", - icon: "creative", - prefix: "demo/", - link: "demo/", - children: "structure", - }, { text: "文章", icon: "note", @@ -17,6 +10,5 @@ export const zhSidebar = sidebar({ children: "structure", }, "intro", - "slides", ], }); diff --git a/src/.vuepress/theme.ts b/src/.vuepress/theme.ts index 907bdf04d..ce1d63ad1 100644 --- a/src/.vuepress/theme.ts +++ b/src/.vuepress/theme.ts @@ -105,12 +105,12 @@ export default hopeTheme({ }, }, - encrypt: { - config: { - "/demo/encrypt.html": ["1234"], - "/zh/demo/encrypt.html": ["1234"], - }, - }, +// encrypt: { +// config: { +// "/demo/encrypt.html": ["1234"], +// "/zh/demo/encrypt.html": ["1234"], +// }, +// }, plugins: { blog: true, diff --git a/src/README.md b/src/README.md index 726b05a3b..8136f4e78 100644 --- a/src/README.md +++ b/src/README.md @@ -4,8 +4,8 @@ layout: BlogHome icon: home title: Blog Home heroImage: /logo.svg -heroText: The name of your blog -tagline: You can put your slogan here +heroText: ChiChen's Blog +tagline: A true master is an eternal student heroFullScreen: true projects: - icon: project diff --git a/src/demo/README.md b/src/demo/README.md deleted file mode 100644 index a3fba3ae4..000000000 --- a/src/demo/README.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Features Demo -index: false -icon: discover -category: - - Guide ---- - -## Catalog - -- [Markdown Enhance](markdown.md) - -- [Page Config](page.md) - -- [Function Disable](disable.md) - -- [Encryption Demo](encrypt.md) diff --git a/src/demo/disable.md b/src/demo/disable.md deleted file mode 100644 index 23577fbe7..000000000 --- a/src/demo/disable.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Disabling layout and features -icon: config -order: 3 -category: - - Guide -tag: - - disable - -navbar: false -sidebar: false - -breadcrumb: false -pageInfo: false -contributors: false -editLink: false -lastUpdated: false -prev: false -next: false -comment: false -footer: false - -backtotop: false ---- - -You can disable some function and layout on the page by setting the Frontmatter of the page. - - - -This page is an demo that disables the following features: - -- Navbar -- Sidebar -- Breadcrumb -- Page information -- Contributors -- Edit link -- Update time -- Prev/Next link -- Comment -- Footer -- Back to top button diff --git a/src/demo/encrypt.md b/src/demo/encrypt.md deleted file mode 100644 index 65161178c..000000000 --- a/src/demo/encrypt.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -icon: lock -category: - - Guide -tag: - - encryption ---- - -# Encryption Article - -The actual article content. - -Paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text paragraph 1 text. - -Paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text paragraph 2 text. diff --git a/src/demo/markdown.md b/src/demo/markdown.md deleted file mode 100644 index 89e981c2f..000000000 --- a/src/demo/markdown.md +++ /dev/null @@ -1,423 +0,0 @@ ---- -title: Markdown Enhance -icon: markdown -order: 2 -category: - - Guide -tag: - - Markdown ---- - -VuePress basically generate pages from Markdown files. So you can use it to generate documentation or blog sites easily. - -You should create and write Markdown files, so that VuePress can convert them to different pages according to file structure. - - - -## Markdown Introduction - -If you are a new learner and don't know how to write Markdown, please read [Markdown Intro](https://theme-hope.vuejs.press/cookbook/markdown/) and [Markdown Demo](https://theme-hope.vuejs.press/cookbook/markdown/demo.html). - -## Markdown Config - -VuePress introduce configuration for each Markdown page using Frontmatter. - -::: info - -Frontmatter is a important concept in VuePress. If you don't know it, you need to read [Frontmatter Introduction](https://theme-hope.vuejs.press/cookbook/vuepress/page.html#front-matter). - -::: - -## Markdown Extension - -The Markdown content in VuePress will be parsed by [markdown-it](https://github.com/markdown-it/markdown-it), which supports [syntax extensions](https://github.com/markdown-it/markdown-it#syntax-extensions) via markdown-it plugins. - -### VuePress Enhancement - -To enrich document writing, VuePress has extended Markdown syntax. - -For these extensions, please read [Markdown extensions in VuePress](https://theme-hope.vuejs.press/basic/vuepress/markdown.html). - -### Theme Enhancement - -By using [`vuepress-plugin-md-enhance`][md-enhance], the theme extends more Markdown syntax and provides richer writing functions. - -#### Custom Container - -::: v-pre - -Safely use {{ variable }} in Markdown. - -::: - -::: info Custom Title - -A custom information container with `code`, [link](#custom-container). - -```js -const a = 1; -``` - -::: - -::: tip Custom Title - -A custom tip container - -::: - -::: warning Custom Title - -A custom warning container - -::: - -::: danger Custom Title - -A custom danger container - -::: - -::: details Custom Title - -A custom details container - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/container.html) - -#### Tabs - -::: tabs#fruit - -@tab apple - -Apple - -@tab banana - -Banana - -@tab orange - -Orange - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/tabs.html) - -#### Code Tabs - -::: code-tabs#shell - -@tab pnpm - -```bash -pnpm add -D vuepress-theme-hope -``` - -@tab yarn - -```bash -yarn add -D vuepress-theme-hope -``` - -@tab:active npm - -```bash -npm i -D vuepress-theme-hope -``` - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/code-tabs.html) - -#### Superscript and Subscript - -19^th^ H~2~O - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/sup-sub.html) - -#### Align - -::: center - -I am center - -::: - -::: right - -I am right align - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/align.html) - -#### Attrs - -A **word**{#word} having id. - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/attrs.html) - -#### Footnote - -This text has footnote[^first]. - -[^first]: This is footnote content - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/footnote.html) - -#### Mark - -You can mark ==important words== . - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/mark.html) - -#### Tasklist - -- [x] Plan A -- [ ] Plan B - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/tasklist.html) - -#### Image Enhancement - -Support setting color scheme and size - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/image.html) - -#### Card - -```card -title: Mr.Hope -desc: Where there is light, there is hope -logo: https://mrhope.site/logo.svg -link: https://mrhope.site -color: rgba(253, 230, 138, 0.15) -``` - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/card.html) - -#### Chart - -::: chart A Scatter Chart - -```json -{ - "type": "scatter", - "data": { - "datasets": [ - { - "label": "Scatter Dataset", - "data": [ - { "x": -10, "y": 0 }, - { "x": 0, "y": 10 }, - { "x": 10, "y": 5 }, - { "x": 0.5, "y": 5.5 } - ], - "backgroundColor": "rgb(255, 99, 132)" - } - ] - }, - "options": { - "scales": { - "x": { - "type": "linear", - "position": "bottom" - } - } - } -} -``` - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/chart.html) - -#### Echarts - -::: echarts A line chart - -```json -{ - "xAxis": { - "type": "category", - "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] - }, - "yAxis": { - "type": "value" - }, - "series": [ - { - "data": [150, 230, 224, 218, 135, 147, 260], - "type": "line" - } - ] -} -``` - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/echarts.html) - -#### Flowchart - -```flow -cond=>condition: Process? -process=>operation: Process -e=>end: End - -cond(yes)->process->e -cond(no)->e -``` - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/flowchart.html) - -#### Mermaid - -```mermaid ---- -title: Flowchart ---- -flowchart TB - c1-->a2 - subgraph one - a1-->a2 - end - subgraph two - b1-->b2 - end - subgraph three - c1-->c2 - end - one --> two - three --> two - two --> c2 -``` - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/mermaid.html) - -#### Tex - -$$ -\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right) -= \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^i r \cdots (r-i+1) (\log y)^{r-i}} {\omega^i} \right\} -$$ - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/tex.html) - -#### Include files - - - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/include.html) - -#### Code Demo - -::: normal-demo A normal demo - -```html -

VuePress Theme Hope

-

Is very powerful!

-``` - -```js -document.querySelector("#very").addEventListener("click", () => { - alert("Very powerful!"); -}); -``` - -```css -span { - color: red; -} -``` - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/demo.html) - -#### Stylize - -Donate Mr.Hope a cup of coffee. _Recommended_ - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/stylize.html) - -#### Playground - -::: playground#ts TS demo - -@file index.ts - -```ts -const msg = "hello world"; - -const speak = (msg: string) => console.log(msg); - -speak(msg); -``` - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/playground.html) - -#### Vue Playground - -::: vue-playground Vue Playground - -@file App.vue - -```vue - - - -``` - -::: - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/vue-playground.html) - -#### Presentation - -@slidestart - -## Slide 1 - -A paragraph with some text and a [link](https://mrhope.site) - ---- - -## Slide 2 - -- Item 1 -- Item 2 - ---- - -## Slide 3.1 - -```js -const a = 1; -``` - --- - -## Slide 3.2 - -$$ -J(\theta_0,\theta_1) = \sum_{i=0} -$$ - -@slideend - -- [View Detail](https://theme-hope.vuejs.press/guide/markdown/presentation.html) - -[md-enhance]: https://md-enhance.vuejs.press/ diff --git a/src/demo/page.md b/src/demo/page.md deleted file mode 100644 index d4a53d8e3..000000000 --- a/src/demo/page.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -# This is the title of the article -title: Page Config -# You can customize cover image -cover: /assets/images/cover1.jpg -# This is the icon of the page -icon: page -# This control sidebar order -order: 1 -# Set author -author: Ms.Hope -# Set writing time -date: 2020-01-01 -# A page can have multiple categories -category: - - Guide -# A page can have multiple tags -tag: - - Page config - - Guide -# this page is sticky in article list -sticky: true -# this page will appear in starred articles -star: true -# You can customize footer content -footer: Footer content for test -# You can customize copyright content -copyright: No Copyright ---- - -Content before `more` comment is regarded as page excerpt. - - - -## Page Information - -You can set page information in Markdown's Frontmatter. - -- The author is Ms.Hope. -- The writing date is January 1, 2020 -- Category is "Guide" -- Tags are "Page Config" and "Guide" - -## Page Content - -You are free to write your Markdown here. - -::: tip Assets - -- You can place images besides your Markdown files, but you should use **relative links** (i.e.: starting with `./`) for them. - -- For images in `.vuepress/public` directory, please use absolute links (i.e.: starting with `/`) for them. - -::: - -The theme contains a custom badge: - -> A dark blue badge text badge at the end of line. - -## Page Structure - -This page should contain: - -- [BreadCrumb](https://theme-hope.vuejs.press/guide/layout/breadcrumb.html) -- [Title and information](https://theme-hope.vuejs.press/guide/feature/page-info.html) -- [TOC (Table of Contents)](https://theme-hope.vuejs.press/guide/layout/page.html#header-list) -- [Meta information including update time and contributors](https://theme-hope.vuejs.press/guide/feature/meta.html) -- [Comments](https://theme-hope.vuejs.press/guide/feature/comment.html) -- [Navbar](https://theme-hope.vuejs.press/guide/layout/navbar.html) -- [Sidebar](https://theme-hope.vuejs.press/guide/layout/sidebar.html) -- [Footer](https://theme-hope.vuejs.press/guide/layout/footer.html) -- Back to top button - -You can customize them in theme options and page frontmatter. diff --git a/src/posts/apple/1.md b/src/posts/apple/1.md deleted file mode 100644 index 96fce8f0a..000000000 --- a/src/posts/apple/1.md +++ /dev/null @@ -1,484 +0,0 @@ ---- -icon: edit -date: 2022-01-01 -category: - - Apple -tag: - - red - - big - - round - - 笔记/编译原理 ---- -# 语法分析 - -- 正则表达式的能力有限,无法分析具体的语法细节(例如嵌套、$a^nb^n$的n值),与其等价的有穷自动机同理,因此引入了下推自动机和上下文有关、无关文法 - -# 大纲 - -- 语法分析的形式化——上下文无关文法 -- 语法分析算法 - -# 上下文无关文法(CFG) - -- 是用来描述一个编程语言的语法结构的文法 -- 和正则表达式一样,可以表示递归的规则,而且更强大 -- 是正则表达式的严格超集 - -## Chomsky语言层级 - -|Chomsky hierarchy|Production(产生式)|Explanation| -|---|---|---| -|unrestricted(type 0)(自然语言)|$\alpha \rightarrow \beta \quad V^+=V_N\cup V_T$$其中\alpha\in V^+,\; \beta\in V^*$|无严格约束| -|context sensitive(type 1)(上下文有关文法)|$\alpha A \gamma \rightarrow \alpha \beta \gamma,$$其中\alpha,\;\gamma\in V^*,\;A \in V_N, \; \beta \in V^+$|在不同的上下文中,$A$可能被不同的$\gamma$替换| -|context free(type 2)(上下文无关文法)|$A\rightarrow \beta ,\;A\in V_N,$$其中\beta \in V^*$|在任何$A$出现的地方都会被$\gamma$替换| -|regular(type 3)(正则表达式)|$A\rightarrow aB\;or\;A\rightarrow a$$(其中A,B\;A,b\in V_N\;,a\in V_T)$|等价于正则表达式| - -- $V_N和V_T$分别是非终止符号集(nonterminal)和终止符号(terminal)集,是由语言设计者设计的集合,终止符就是常说的token -- 如果一个符号由它自身定义($a\rightarrow a$或$int \rightarrow int$)那么就是一个终止符号,通常是标点符号,如分号,括号等 -- 如果一个符号有其定义的可再分的结构就是一个非终止符号($letter\rightarrow [A-Za-z]$),通常是句子,短语,表达式等 -- 要注意,$A^*$(Kleene闭包)是正则表达式特有的规则,CFG中没有,"|"在CFG中表示的是或,用来简化表示多个产生式,而不是正则表达式中的Union。 -- CFG文法规定的第一个文法的左部是开始符号,规定了该语言都满足的一个规则 -- 一个处于较低层级的文法是上级文法的特例,例如RE就是一种特殊的CFG - -## 形式化定义 - -$$\begin{array}{c} -CFG:G=(V_T,V_N,P,S)\\ -V_T\text{是终止符集合}\\ -V_N\text{是非终止符集合,}V_N\cap V_T=\varnothing\\ -P\text{是产生式集合,或称语法规则集,满足}A\rightarrow \beta \;A\in V_N和\beta \in (V_N\cup V_T)^*\\ -S\text{是初始符号,}S\in V_N -\end{array}$$ - -### EBNF(Extended Backus-Naur form) - -- $\rightarrow$:$X\rightarrow Y_1Y_2Y_3...Y_N$表示$X\text{可以用}Y_1Y_2Y_3...Y_N$来代替,$X\rightarrow \varepsilon$表示$X$可以用空串代替,这种$A\rightarrow \alpha$被称为BNF表示法 -- 简化表示: - 1. 除非特殊说明,否则第一个产生式的左部就是初始符号 - 2. 用小写字母表示终止符号 - 3. 用大写字符或者$<...>$表示非终止符号 - 4. 如果左部都为$A$的一系列产生式$A\rightarrow \alpha_2,\;...,\;A\rightarrow \alpha_n,\;$可以简写为$A\rightarrow \alpha_1 | \alpha _2|...|\alpha_n$ -- 特别注意: -$$\begin{array}{c} - S\rightarrow a^*b \text{(错误写法,没有Kleene闭包)}\\ - S\rightarrow Ab\\ - A\rightarrow Aa|\varepsilon -\end{array}$$ - -$$\begin{array}{c} -S\rightarrow a(b|c)(错误,没有括号)\\ -S\rightarrow aX\\ -X\rightarrow b|c -\end{array}$$ -- 左递归:$A \rightarrow A\alpha|\beta\;(left\;recursive)$可表示$\beta ,\;\beta \alpha,\; \beta \alpha \alpha...$即有推导$A\Rightarrow^*\beta \alpha^n(n=0,1,2,...)$在EBNF中可表示为$A\rightarrow\beta \{\alpha \}$ -- 右递归:$A \rightarrow \alpha A|\beta\;(right\;recursive)$可表示$\beta,\; \alpha \beta,\; \alpha \beta \beta...$即有推导$A\Rightarrow^* \alpha^n \beta(n=0,1,2,...)$在EBNF中可表示为$A\rightarrow \{\alpha \}\beta$ -- 结合性 -$$\begin{array}{c} -exp\rightarrow exp\; addop\; term|term\\ -exp\rightarrow term\{addop\;term\}\text{(左结合性)}\\ -exp\rightarrow term[addop \; term]\text{(右结合性)} -\end{array}$$ -- 中括号表示其中的符号出现0次或1次,大括号表示0次或 - -## 推导(Derivation)与规约(Reduction) - -- 如果能用一步步推导从初始符号得到需要验证的式子,那么式子就是符合规则的 -- 推导就是不断用产生式的右部来替换一个非终止符 -- $\Rightarrow^*$表示多步推导 -- 由终止符号构成的串称为句子(sentence),由非终止符号构成的串是句型(sentential form) -- 以S为开始符号的CFG构成的语言: - $$L(G)=\{s\in V_T^*|\;there\;exists\;S\Rightarrow^*s\;of\; G\}$$ - -### 语法树 - -- 根节点是开始符号 -- 内部节点是非终止符号 -- 叶子节点是终止符号或者$\varepsilon$ -- 如果节点A有子节点$X_1,X_2,...,X_N$则意为$A\rightarrow X_1X_2...X_N$ -- 最终的叶子节点连起来就是一个句子 -- 不同的推导会得到不同的树,但是可能会有相同的结果。 - -### 最左推导(LeftMost Derivation前缀推导) - -- 总是对句型中最左侧的非终止符号进行一次推导 -- 从开始符号推导到结果,被称为Top-down - -### 最右推导(RightMost Derivation) - -- 从结果反向推回开始符号,这个过程被称为规约$s\Rightarrow^*S$ -- 等价于对语法树进行后序遍历的逆过程 -- 最右推导的能力比最左推导要强 - -### 抽象语法树 - -![[语法树与抽象语法树.png]] - -- 比起语法树,省略了部分细节,带来了更好的语法抽象,对于后续编译阶段是一个更好的数据结构 -- 它反映了源码token序列的一个抽象,比语法树更高效 - -## 歧义(Ambiguity) - -- 对于一个CFG,同样的输入可能有不同的解析 -![[语法树歧义.png]] - -### 解决方法 - -- 消除歧义(Disambiguity rule):不改变文法,列举所有可能造成歧义的情况并进行消除,不现实的 -- 文法重写:改变文法,进行同义转换:(添加优先级,添加关联性) -$$E\rightarrow E-E|E \times E|(E)|i\;\Rightarrow \begin{array}{c} -E\rightarrow E-E|T\\ -T\rightarrow T\times T|F\\ -F\rightarrow(E)|i -\end{array}$$ -![[消除歧义1.png]] -![[消除歧义2.png]] -![[消除歧义3.png]] - -# 语法分析算法(parsing) - -## Top-Down(Leftmost) parsing - -- 本质上是一个图搜索问题,在树上搜索,查找能否获得一个与输入sentence匹配的路径 - -### 回溯算法(Backtracking) - -- 用BFS:进行图遍历搜索,复杂,时间复杂度过高,产生大量无用分支,时间和空间的最差情况都是指数级别。现代编译器中不被使用 -- 剪枝:由终止符号做前缀时,如果无法与输入的前缀匹配则剪枝。($Aa|Ab|c\rightarrow caaaaa$时,无法剪枝,因为前缀一直是非终止符号) -- 用DFS:有比BFS更好的空间复杂度和时间复杂度,但是无法匹配($Aa|c\rightarrow c$,因为会一直循环) - -### 预测推导(predictive parsing) - -- Idea:利用先行词(lokkahead tokens),也就是上面提到过的终止符前缀 -- 两种分析方法: - - 1. 递归下降分析(Recursive-descent parsing) - 2. LL(1)分析 - -#### 预测分析的概念 - -- 从输入串和文法的开始符号开始分析 -- 可以从当前输入的token(s)唯一确定下一个要使用的产生式 -- 预测分析文法包括LL(k)文法,其中L表示从左向右扫描,L表示最左推导,k表示“需要$\le k$个先行词用于预测 ” -- LL(1)文法是常用的,也不完全常用 - -##### Lookahead Sets - -###### First Sets(具体计算看讲义和书) - -- 定义 -$$\begin{array}{c} -G=(V_N,V_T,P,S)\text{是一个文法}\\ -\beta\in(V_N\cup V_T)^*\\ -FIRST(\beta)=\{\alpha\in V_T|\beta\Rightarrow^*a...\}\\ -if\;\beta\Rightarrow^*\varepsilon\;then\;\varepsilon\in FIRST(\beta) -\end{array}$$ -- 计算 - -![[First()计算 1.png]] -![[First()计算 2.png]] -![[First()计算 3.png]] -![[First()计算 4.png]] -![[First()计算 5.png]] -//Todo 提取简练笔记 - -###### Follow Sets - -- 定义: -$$\begin{array}{c} -G=(V_N,V_T,P,S)\text{是一个文法}\\A\in V_N\\ -FOLLOW(A)=\{a\in V_T|S\Rightarrow^*...Aa...\},\\ -if\;S\Rightarrow...A,\;then\;\$\in FOLLOW(A)\\ -\$是用来标记输入的终止的符号 - -\end{array}$$ - -- 计算: -![[Follow()计算 1.png]] -![[Follow()计算 2.png]] - -##### 可空的非终止符(nullable nonterminal) - -- 定义: - $$S\Rightarrow^*\varepsilon$$ -则称S是一个可空的非终止符 -- 计算: -![[nullble set计算 1.png]] -![[nullble set计算 2.png]] - -##### 判定LL(1)文法 - -- 计算每个可空的非终止符 -- 计算产生式右侧所有的$FIRST(\alpha)$并验证其两两交集是否为空 -- 计算(1)中算出的非终止符的$FOLLOW(A)$并验证$FIRST(A)\cap FOLLOW(A)=\varnothing$ -![[判断LL(1)示例.png]] - -##### 非LL(1)到LL(1) - -- 两种简单的非LL(1)情形: - - 1. 左因子,例如$A\rightarrow \alpha \beta|\alpha r$,这是两个产生式的简写,其产生式交集为$\alpha$,改写方法为 - $$\begin{array}{c} -A\rightarrow\alpha\beta_1|\alpha\beta_2|...|\alpha\beta_n\;重写为:\\ -A\rightarrow\alpha A{'}\quad A^{'}\rightarrow\beta_1|\beta_2|...|\beta_n -\end{array}$$ - 2. 左递归,包括直接左递归和间接左递归,例如$A\rightarrow A \beta$和$A\rightarrow B \beta\quad B\rightarrow A\alpha$ 改写方法为 -$$\begin{array}{c} -A\rightarrow A \alpha|\beta\;\text{重写为:}\\ -A\rightarrow\beta A^{'}\; ,\;A^{'}\rightarrow\alpha A^{'}|\varepsilon\\ -\text{一般情况为:}\\ -A\rightarrow A \alpha_1|A \alpha_2|...|A \alpha_m|\beta_1|\beta_2|...|\beta_n\; \text{重写为:}\\ -A\rightarrow \beta_1 A^{'}|\beta_2 A^{'}|...|\beta_n A^{'}\\ -A^{'}\rightarrow\alpha_1 A^{'}|\alpha_1 A^{'}|...|\alpha_m A^{'}|\varepsilon -\end{array}$$ - -- 要注意:将这两者进行改写后并不能保证改写后的文法是LL(1),仍需要再进行验证 - -#### 递归下降 - -##### 输入 - -- 非终止符号递归调用,终止符号匹配 - -```cpp -int main(){ - Token token = getNextToken(); - S();/*S is the start symbol*/ - if(token!='$') throw error; -} -void A(){ - /*select a production of A:A→X_1X_2...X_k*/ - for(int i=0; i - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/apple/3.md b/src/posts/apple/3.md deleted file mode 100644 index 1dc40b75e..000000000 --- a/src/posts/apple/3.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -icon: edit -date: 2022-01-03 -category: - - Apple - - Fruit -tag: - - red - - big - - round ---- - -# Apple 3 - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/apple/4.md b/src/posts/apple/4.md deleted file mode 100644 index ef1b90491..000000000 --- a/src/posts/apple/4.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -icon: edit -date: 2022-01-04 -category: - - Apple - - Fruit -tag: - - red - - big - - round ---- - -# Apple 4 - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/banana/1.md b/src/posts/banana/1.md deleted file mode 100644 index 1a887ed2f..000000000 --- a/src/posts/banana/1.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -icon: edit -date: 2022-01-05 -category: - - Banana - - Fruit -tag: - - yellow - - curly - - long ---- - -# Banana 1 - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/banana/2.md b/src/posts/banana/2.md deleted file mode 100644 index fab28152c..000000000 --- a/src/posts/banana/2.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -icon: edit -date: 2022-01-06 -category: - - Banana - - Fruit -tag: - - yellow - - curly - - long -star: 10 ---- - -# Banana 2 - -A banana article being stared with number `10`. - - - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/banana/3.md b/src/posts/banana/3.md deleted file mode 100644 index 29192494e..000000000 --- a/src/posts/banana/3.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-07 -category: - - Banana -tag: - - yellow - - curly - - long ---- - -# Banana 3 - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/banana/4.md b/src/posts/banana/4.md deleted file mode 100644 index f4e27a845..000000000 --- a/src/posts/banana/4.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-08 -category: - - Banana -tag: - - yellow - - curly - - long ---- - -# Banana 4 - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/cherry.md b/src/posts/cherry.md deleted file mode 100644 index 576aa94cf..000000000 --- a/src/posts/cherry.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-09 -category: - - Cherry -tag: - - red - - small - - round ---- - -# Cherry - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/dragonfruit.md b/src/posts/dragonfruit.md deleted file mode 100644 index 07c00929d..000000000 --- a/src/posts/dragonfruit.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-10 -category: - - Dragon Fruit - - Fruit -tag: - - red - - big ---- - -# Dragon Fruit - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/strawberry.md b/src/posts/strawberry.md deleted file mode 100644 index 3a38aff10..000000000 --- a/src/posts/strawberry.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-11 -category: - - Fruit - - Strawberry -tag: - - red - - small ---- - -# Strawberry - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/posts/template.md b/src/posts/template.md new file mode 100644 index 000000000..876b5c909 --- /dev/null +++ b/src/posts/template.md @@ -0,0 +1,18 @@ +--- +title: template +# cover: /assets/images/cover1.jpg + +icon: page +# This control sidebar order +order: 1 +author: ChiChen +date: template +category: + - +tag: + - +sticky: true +star: false +footer: +copyright: Copyright with marking the source +--- \ No newline at end of file diff --git a/src/posts/tomato.md b/src/posts/tomato.md deleted file mode 100644 index be3f616e8..000000000 --- a/src/posts/tomato.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -cover: /assets/images/cover2.jpg -icon: edit -date: 2022-01-12 -category: - - Vegetable -tag: - - red - - round -star: true -sticky: true ---- - -# Tomato - -## Heading 2 - -Here is the content. - -### Heading 3 - -Here is the content. diff --git a/src/slides.md b/src/slides.md deleted file mode 100644 index c135c2607..000000000 --- a/src/slides.md +++ /dev/null @@ -1,433 +0,0 @@ ---- -title: Slide page -icon: slides -layout: Slide ---- - - - -@slidestart - - - -## Slide Demo - - - -A simple slide demo and useful hints. - - - -> By Mr.Hope. Please scroll mouse wheel down to the next slide - ---- - - - -## Marking Slides - - - -[👇](#/1/1) - --- - - - -## Marking Slides - - - -Use `---` to mark horizontal slides - - - -Use `--` to separate vertical slides in a horizontal slide. - - - -Use `` to add attributes to slide - - - -Use `` to add attributes to the previous html element - - - ---- - - - -## Markdown - - - -You can use all kinds of markup in slides. - - - --- - - - -## Markdown - -You can use all kinds of markup in slides. - -### This is a H3 - -Headings will transform to UPPERCASE by default. - -Here is paragraph with some **bold**, _italic_, ~~strike-through~~ text and a [link](https://mrhope.site), and it can auto break itself so you don't need to worry the length. - --- - - - -## Markdown - -You can use all kinds of markup in slides. - -List is `inline-block` by default. - -- Item -- Item -- Item - -1. Item 1 -1. Item 2 -1. Item 3 - --- - - - -## Markdown - -You can use all kinds of markup in slides. - -Code block will get auto highlight if you enable `highlight` plugin. - -```js -const a = 1; -``` - --- - - - -## Markdown - -You can use all kinds of markup in slides. - -You can also write math equation using tex syntax if you enable `math` plugin. - -$$ -J(\theta_0,\theta_1) = \sum_{i=0} -$$ - --- - - - -## Markdown - -You can use all kinds of markup in slides. - -⚠**Note**: Table, hr and other nonstandard Markdown syntax is not supported. - ---- - - - -## Layout - - - --- - - - -## Layout - - - -👆 The `r-fit-text` class makes text as large as possible without overflowing the slide. - --- - - - -## Layout - -![Logo](/logo.svg) - - - -👆 The `r-stretch` class helper lets you resize an element, like an image or video, to cover the remaining vertical space in a slide. - --- - - - -## Layout - -### Background - -Custom background by adding `data-background` attribute to slide. - ---- - - - -## Fragment - - - --- - - - -## Fragment - - - -Fragments are used to highlight or incrementally reveal individual elements on a slide. - -Add `fragment` and animation class to element. - --- - - - -## Fragment - -### Animation class - -- `fade-in` - - -- `fade-out` - - -- `fade-up` - - - - -- `fade-down` - - -- `fade-left` - - -- `fade-right` - - - - -- `fade-in-then-out` - - -- `fade-in-then-semi-out` - - --- - - - -## Fragment - -### Animation class - -- `grow` - - -- `shrink` - - -- `strike` - - - - -- `highlight-red` - - -- `highlight-green` - - -- `highlight-blue` - - - - -- `highlight-current-red` - - -- `highlight-current-green` - - -- `highlight-current-blue` - - --- - - - -## Fragment - -### Multiple fragments - -Multiple fragments can be applied to the same element sequentially by wrapping it - - - - - Fade in > Turn red > Fade out - - - - --- - - - -## Fragment - -### Order - -Order can be changed using the `data-fragment-index` attribute. - -Multiple elements can appear at the same index. - -- Appears last - - -- Appears second - - - - -- Appears first - - -- Appears second - - ---- - - - -## Transition - - - --- - - - -## Transition - - - -Transition can be changed by setting the `transition` config option globally or `data-transition` attribute on slide. - -Possible values: - -- none -- fade -- slide - - - -- convex -- concave -- zoom - --- - - - -## Transition - - - -### Auto animate - -`data-auto-animate` can be added on nearby slides to make an animation on unchanged elements. - ---- - - - -## Functions - - - --- - - - -## Functions - - - -### Code - -By enabling `highlight` plugin, you can highlight code blocks. - -You can use `[a-b|c-d]` syntax to highlight lines by steps. - -```js [1-2|3|4] -let a = 1; -let b = 2; -let c = (x) => 1 + 2 + x; -c(3); -``` - --- - - - -## Functions - - - -### Overview - -Press `Esc` or `O` to enter overview mode when the presentation is active - --- - - - -## Functions - - - -### Full Screen - -Press `F` or `F11` to enter fullscreen when the presentation is active - --- - - - -## Functions - - - -### Zoom - -Hold down the `alt` key (`ctrl` in Linux) and click on any element to zoom towards it. - -Click again to zoom back out. - ---- - - - -## The End - -@slideend diff --git a/src/zh/README.md b/src/zh/README.md index 2700c5061..69a1d9963 100644 --- a/src/zh/README.md +++ b/src/zh/README.md @@ -6,43 +6,38 @@ title: 博客主页 heroImage: /logo.svg heroText: Chi heroFullScreen: true -tagline: 三十年河东三十年河西 +tagline: 真正的大师永远都怀着一颗学徒的心 projects: - icon: project name: DragonOS desc: Rust开发的服务器操作系统 link: https://github.com/DragonOS-Community/DragonOS - - icon: link - name: 链接名称 - desc: 链接详细描述 - link: https://链接地址 +# - icon: link +# name: 链接名称 +# desc: 链接详细描述 +# link: https://链接地址 - - icon: book - name: 书籍名称 - desc: 书籍详细描述 - link: https://你的书籍链接 +# - icon: book +# name: 书籍名称 +# desc: 书籍详细描述 +# link: https://你的书籍链接 - - icon: article - name: 文章名称 - desc: 文章详细描述 - link: https://你的文章链接 +# - icon: article +# name: 文章名称 +# desc: 文章详细描述 +# link: https://你的文章链接 - - icon: friend - name: 伙伴名称 - desc: 伙伴详细介绍 - link: https://你的伙伴链接 +# - icon: friend +# name: 伙伴名称 +# desc: 伙伴详细介绍 +# link: https://你的伙伴链接 - - icon: /logo.svg - name: 自定义项目 - desc: 自定义详细介绍 - link: https://你的自定义链接 +# - icon: /logo.svg +# name: 自定义项目 +# desc: 自定义详细介绍 +# link: https://你的自定义链接 -footer: 自定义你的页脚文字 +footer: --- -这是一个博客主页的案例。 - -要使用此布局,你应该在页面前端设置 `layout: BlogHome` 和 `home: true`。 - -相关配置文档请见 [博客主页](https://theme-hope.vuejs.press/zh/guide/blog/home/)。 diff --git a/src/zh/demo/README.md b/src/zh/demo/README.md deleted file mode 100644 index b2abca1c8..000000000 --- a/src/zh/demo/README.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: 主要功能与配置演示 -index: false -icon: discover -category: - - 使用指南 ---- - -## 目录 - -- [Markdown 展示](markdown.md) - -- [页面展示](page.md) - -- [禁用展示](disable.md) - -- [加密展示](encrypt.md) diff --git a/src/zh/demo/disable.md b/src/zh/demo/disable.md deleted file mode 100644 index d6f6ab3c9..000000000 --- a/src/zh/demo/disable.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: 布局与功能禁用 -icon: config -order: 3 -category: - - 使用指南 -tag: - - 禁用 - -navbar: false -sidebar: false - -breadcrumb: false -pageInfo: false -contributors: false -editLink: false -lastUpdated: false -prev: false -next: false -comment: false -footer: false - -backtotop: false ---- - -你可以通过设置页面的 Frontmatter,在页面禁用功能与布局。 - - - -本页面就是一个示例,禁用了如下功能: - -- 导航栏 -- 侧边栏 -- 路径导航 -- 页面信息 -- 贡献者 -- 编辑此页链接 -- 更新时间 -- 上一篇/下一篇 链接 -- 评论 -- 页脚 -- 返回顶部按钮 diff --git a/src/zh/demo/encrypt.md b/src/zh/demo/encrypt.md deleted file mode 100644 index 25370d00d..000000000 --- a/src/zh/demo/encrypt.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -icon: lock -category: - - 使用指南 -tag: - - 文章加密 ---- - -# 密码加密的文章 - -实际的文章内容。 - -段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字段落 1 文字。 - -段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字段落 2 文字。 diff --git a/src/zh/demo/markdown.md b/src/zh/demo/markdown.md deleted file mode 100644 index a37c9656e..000000000 --- a/src/zh/demo/markdown.md +++ /dev/null @@ -1,403 +0,0 @@ ---- -title: Markdown 展示 -icon: markdown -order: 2 -category: - - 使用指南 -tag: - - Markdown ---- - -VuePress 主要从 Markdown 文件生成页面。因此,你可以使用它轻松生成文档或博客站点。 - -你应该创建和编写 Markdown 文件,以便 VuePress 可以根据文件结构将它们转换为不同的页面。 - - - -## Markdown 介绍 - -如果你是一个新手,还不会编写 Markdown,请先阅读 [Markdown 介绍](https://theme-hope.vuejs.press/zh/cookbook/markdown/) 和 [Markdown 演示](https://theme-hope.vuejs.press/zh/cookbook/markdown/demo.html)。 - -## Markdown 配置 - -VuePress 通过 Frontmatter 为每个 Markdown 页面引入配置。 - -::: info - -Frontmatter 是 VuePress 中很重要的一个概念,如果你不了解它,你需要阅读 [Frontmatter 介绍](https://theme-hope.vuejs.press/zh/cookbook/vuepress/page.html#front-matter)。 - -::: - -## Markdown 扩展 - -VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来解析 Markdown 内容,因此可以借助于 markdown-it 插件来实现 [语法扩展](https://github.com/markdown-it/markdown-it#syntax-extensions) 。 - -### VuePress 扩展 - -为了丰富文档写作,VuePress 对 Markdown 语法进行了扩展。 - -关于这些扩展,请阅读 [VuePress 中的 Markdown 扩展](https://theme-hope.vuejs.press/zh/cookbook/vuepress/markdown.html)。 - -### 主题扩展 - -通过 [`vuepress-plugin-md-enhance`][md-enhance],主题扩展了更多 Markdown 语法,提供更加丰富的写作功能。 - -#### 自定义容器 - -::: v-pre - -安全的在 Markdown 中使用 {{ variable }}。 - -::: - -::: info 自定义标题 - -信息容器,包含 `代码` 与 [链接](#自定义容器)。 - -```js -const a = 1; -``` - -::: - -::: tip 自定义标题 - -提示容器 - -::: - -::: warning 自定义标题 - -警告容器 - -::: - -::: danger 自定义标题 - -危险容器 - -::: - -::: details 自定义标题 - -详情容器 - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/container.html) - -#### 代码块 - -::: code-tabs - -@tab pnpm - -```bash -pnpm add -D vuepress-theme-hope -``` - -@tab yarn - -```bash -yarn add -D vuepress-theme-hope -``` - -@tab:active npm - -```bash -npm i -D vuepress-theme-hope -``` - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/code-tabs.html) - -#### 上下角标 - -19^th^ H~2~O - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/sup-sub.html) - -#### 自定义对齐 - -::: center - -我是居中的 - -::: - -::: right - -我在右对齐 - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/align.html) - -#### Attrs - -一个拥有 ID 的 **单词**{#word}。 - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/attrs.html) - -#### 脚注 - -此文字有脚注[^first]. - -[^first]: 这是脚注内容 - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/footnote.html) - -#### 标记 - -你可以标记 ==重要的内容== 。 - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/mark.html) - -#### 任务列表 - -- [x] 计划 1 -- [ ] 计划 2 - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/tasklist.html) - -### 图片增强 - -支持为图片设置颜色模式和大小 - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/image.html) - -#### 卡片 - -```card -title: Mr.Hope -desc: Where there is light, there is hope -logo: https://mrhope.site/logo.svg -link: https://mrhope.site -color: rgba(253, 230, 138, 0.15) -``` - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/card.html) - -#### 图表 - -::: chart 一个散点图案例 - -```json -{ - "type": "scatter", - "data": { - "datasets": [ - { - "label": "散点数据集", - "data": [ - { "x": -10, "y": 0 }, - { "x": 0, "y": 10 }, - { "x": 10, "y": 5 }, - { "x": 0.5, "y": 5.5 } - ], - "backgroundColor": "rgb(255, 99, 132)" - } - ] - }, - "options": { - "scales": { - "x": { - "type": "linear", - "position": "bottom" - } - } - } -} -``` - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/chart.html) - -#### Echarts - -::: echarts 一个折线图案例 - -```json -{ - "xAxis": { - "type": "category", - "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] - }, - "yAxis": { - "type": "value" - }, - "series": [ - { - "data": [150, 230, 224, 218, 135, 147, 260], - "type": "line" - } - ] -} -``` - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/echarts.html) - -#### 流程图 - -```flow -cond=>condition: 是否执行操作? -process=>operation: 操作 -e=>end: 结束 - -cond(yes)->process->e -cond(no)->e -``` - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/flowchart.html) - -#### Mermaid - -```mermaid ---- -title: Flowchart ---- -flowchart TB - c1-->a2 - subgraph one - a1-->a2 - end - subgraph two - b1-->b2 - end - subgraph three - c1-->c2 - end - one --> two - three --> two - two --> c2 -``` - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/mermaid.html) - -#### Tex 语法 - -$$ -\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right) -= \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^i r \cdots (r-i+1) (\log y)^{r-i}} {\omega^i} \right\} -$$ - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/tex.html) - -#### 导入文件 - - - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/include.html) - -#### 代码演示 - -::: normal-demo 一个普通 Demo - -```html -

VuePress Theme Hope

-

非常强大!

-``` - -```js -document.querySelector("#very").addEventListener("click", () => { - alert("非常强大"); -}); -``` - -```css -span { - color: red; -} -``` - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/demo.html) - -#### 样式化 - -向 Mr.Hope 捐赠一杯咖啡。 _Recommended_ - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/stylize.html) - -#### 交互演示 - -::: playground#ts TS 案例 - -@file index.ts - -```ts -const msg = "hello world"; - -const speak = (msg: string) => console.log(msg); - -speak(msg); -``` - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/playground.html) - -#### Vue 交互演示 - -::: vue-playground Vue 交互演示 - -@file App.vue - -```vue - - - -``` - -::: - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/vue-playground.html) - -#### 幻灯片 - -@slidestart - -## 幻灯片 1 - -一个有文字和 [链接](https://mrhope.site) 的段落 - ---- - -## 幻灯片 2 - -- 项目 1 -- 项目 2 - ---- - -## 幻灯片 3.1 - -```js -const a = 1; -``` - --- - -## 幻灯片 3.2 - -$$ -J(\theta_0,\theta_1) = \sum_{i=0} -$$ - -@slideend - -- [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/presentation.html) - -[md-enhance]: https://plugin-md-enhance.vuejs.press/zh/ diff --git a/src/zh/demo/page.md b/src/zh/demo/page.md deleted file mode 100644 index 5b120d9a7..000000000 --- a/src/zh/demo/page.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -# 这是文章的标题 -title: 页面配置 -# You can customize cover image -cover: /assets/images/cover1.jpg -# 这是页面的图标 -icon: page -# 这是侧边栏的顺序 -order: 1 -# 设置作者 -author: Ms.Hope -# 设置写作时间 -date: 2020-01-01 -# 一个页面可以有多个分类 -category: - - 使用指南 -# 一个页面可以有多个标签 -tag: - - 页面配置 - - 使用指南 -# 此页面会在文章列表置顶 -sticky: true -# 此页面会出现在文章收藏中 -star: true -# 你可以自定义页脚 -footer: 这是测试显示的页脚 -# 你可以自定义版权信息 -copyright: 无版权 ---- - -`more` 注释之前的内容被视为文章摘要。 - - - -## 页面信息 - -你可以在 Markdown 的 Frontmatter 中设置页面信息。 - -- 作者设置为 Ms.Hope。 -- 写作日期为 2020 年 1 月 1 日 -- 分类为 “使用指南” -- 标签为 “页面配置” 和 “使用指南” - -## 页面内容 - -你可以自由在这里书写你的 Markdown。 - -::: tip - -- 你可以将图片和 Markdown 文件放置在一起,但是你需要使用**相对链接**`./` 进行引用。 - -- 对于 `.vuepress/public` 文件夹的图片,请使用绝对链接 `/` 进行引用。 - -::: - -主题包含了一个自定义徽章可以使用: - -> 文字结尾应该有深蓝色的 徽章文字 徽章。 - -## 页面结构 - -此页面应当包含: - -- [路径导航](https://theme-hope.vuejs.press/zh/guide/layout/breadcrumb.html) -- [标题和页面信息](https://theme-hope.vuejs.press/zh/guide/feature/page-info.html) -- [TOC (文章标题列表)](https://theme-hope.vuejs.press/zh/guide/layout/page.html#标题列表) -- [贡献者、更新时间等页面元信息](https://theme-hope.vuejs.press/guide/feature/meta.html) -- [评论](https://theme-hope.vuejs.press/zh/guide/feature/comment.html) -- [导航栏](https://theme-hope.vuejs.press/zh/guide/layout/navbar.html) -- [侧边栏](https://theme-hope.vuejs.press/zh/guide/layout/sidebar.html) -- [页脚](https://theme-hope.vuejs.press/zh/guide/layout/footer.html) -- 返回顶部按钮 - -你可以通过主题选项和页面 Frontmatter 自定义它们。 diff --git a/src/zh/posts/banana/1.md b/src/zh/posts/banana/1.md deleted file mode 100644 index 2df5e9365..000000000 --- a/src/zh/posts/banana/1.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -icon: edit -date: 2022-01-05 -category: - - 香蕉 - - 水果 -tag: - - 黄 - - 弯曲的 - - 长 ---- - -# 香蕉 1 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/banana/2.md b/src/zh/posts/banana/2.md deleted file mode 100644 index 16db08c9b..000000000 --- a/src/zh/posts/banana/2.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -icon: edit -date: 2022-01-06 -category: - - 香蕉 - - 水果 -tag: - - 黄 - - 弯曲的 - - 长 -star: 10 ---- - -# 香蕉 2 - -一个被数字 `10` 星标了的香蕉文章。 - - - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/banana/3.md b/src/zh/posts/banana/3.md deleted file mode 100644 index cce484a52..000000000 --- a/src/zh/posts/banana/3.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-07 -category: - - 香蕉 -tag: - - 黄 - - 弯曲的 - - 长 ---- - -# 香蕉 3 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/banana/4.md b/src/zh/posts/banana/4.md deleted file mode 100644 index b69370e36..000000000 --- a/src/zh/posts/banana/4.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-08 -category: - - 香蕉 -tag: - - 黄 - - 弯曲的 - - 长 ---- - -# 香蕉 4 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/cherry.md b/src/zh/posts/cherry.md deleted file mode 100644 index f2b22d1eb..000000000 --- a/src/zh/posts/cherry.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-09 -category: - - 樱桃 -tag: - - 红 - - 小 - - 圆 ---- - -# 樱桃 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/dragonfruit.md b/src/zh/posts/dragonfruit.md deleted file mode 100644 index c222eea10..000000000 --- a/src/zh/posts/dragonfruit.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-10 -category: - - 火龙果 - - 水果 -tag: - - 红 - - 大 ---- - -# 火龙果 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/strawberry.md b/src/zh/posts/strawberry.md deleted file mode 100644 index 014fce758..000000000 --- a/src/zh/posts/strawberry.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -icon: edit -date: 2022-01-11 -category: - - 水果 - - 草莓 -tag: - - 红 - - 小 ---- - -# 草莓 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git a/src/zh/posts/template.md b/src/zh/posts/template.md new file mode 100644 index 000000000..e47f352f1 --- /dev/null +++ b/src/zh/posts/template.md @@ -0,0 +1,19 @@ +--- +title: template +# cover: /assets/images/cover1.jpg +icon: page +# This control sidebar order +order: 1 +author: ChiChen +date: template +category: + - +tag: + - +# this page is sticky in article list +sticky: true +# this page will appear in starred articles +star: false +footer: +copyright: 转载请注明出处 +--- \ No newline at end of file diff --git a/src/zh/posts/tomato.md b/src/zh/posts/tomato.md deleted file mode 100644 index 24ea63a0e..000000000 --- a/src/zh/posts/tomato.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -cover: /assets/images/cover2.jpg -icon: edit -date: 2022-01-12 -category: - - 蔬菜 -tag: - - 红 - - 圆 -star: true -sticky: true ---- - -# 番茄 - -## 标题 2 - -这里是内容。 - -### 标题 3 - -这里是内容。 diff --git "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter0 \345\211\215\350\250\200.md" "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter0 \345\211\215\350\250\200.md" index 09ed9c765..3743f5708 100644 --- "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter0 \345\211\215\350\250\200.md" +++ "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter0 \345\211\215\350\250\200.md" @@ -1,12 +1,20 @@ --- -name: Chapter0 前言 -icon: edit -date: 2022-01-01 +title: Chapter0 前言 +# cover: /assets/images/cover1.jpg + +icon: page +order: 1 +author: ChiChen +date: 2023-10-11 category: - 笔记 tag: - 笔记/编译原理 +sticky: true +star: false +footer: +copyright: 转载请注明出处 --- # 前言 diff --git "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter1 \347\274\226\350\257\221\345\231\250\347\273\204\346\210\220.md" "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter1 \347\274\226\350\257\221\345\231\250\347\273\204\346\210\220.md" index 691aeeee5..7e1de315c 100644 --- "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter1 \347\274\226\350\257\221\345\231\250\347\273\204\346\210\220.md" +++ "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter1 \347\274\226\350\257\221\345\231\250\347\273\204\346\210\220.md" @@ -1,13 +1,22 @@ --- -name: Chapter1 编译器组成 -icon: edit -date: 2022-01-01 +title: Chapter1 编译器组成 +# cover: /assets/images/cover1.jpg + +icon: page +order: 1 +author: ChiChen +date: 2023-10-11 category: - 笔记 tag: - 笔记/编译原理 +sticky: true +star: false +footer: +copyright: 转载请注明出处 --- + # Chapter1 编译器组成 ## 编译器的结构 diff --git "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter2 \350\257\215\346\263\225\345\210\206\346\236\220.md" "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter2 \350\257\215\346\263\225\345\210\206\346\236\220.md" index 48fc1bae5..18657a197 100644 --- "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter2 \350\257\215\346\263\225\345\210\206\346\236\220.md" +++ "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter2 \350\257\215\346\263\225\345\210\206\346\236\220.md" @@ -1,13 +1,22 @@ --- -name: Chapter2 词法分析 -icon: edit -date: 2022-01-01 +title: Chapter2 词法分析 +# cover: /assets/images/cover1.jpg + +icon: page +order: 1 +author: ChiChen +date: 2023-10-11 category: - 笔记 tag: - 笔记/编译原理 +sticky: true +star: false +footer: +copyright: 转载请注明出处 --- + # Chapter2 词法分析 ## 大纲 diff --git "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter3 \350\257\255\346\263\225\345\210\206\346\236\220.md" "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter3 \350\257\255\346\263\225\345\210\206\346\236\220.md" index 88ea168cf..4b1c9e3d8 100644 --- "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter3 \350\257\255\346\263\225\345\210\206\346\236\220.md" +++ "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter3 \350\257\255\346\263\225\345\210\206\346\236\220.md" @@ -1,13 +1,22 @@ --- -name: Chapter3 语法分析 -icon: edit -date: 2022-01-01 +title: Chapter3 语法分析 +# cover: /assets/images/cover1.jpg + +icon: page +order: 1 +author: ChiChen +date: 2023-10-11 category: - 笔记 tag: - 笔记/编译原理 +sticky: true +star: false +footer: +copyright: 转载请注明出处 --- + # Chapter3 语法分析 - 正则表达式的能力有限,无法分析具体的语法细节(例如嵌套、$a^nb^n$的n值),与其等价的有穷自动机同理,因此引入了下推自动机和上下文有关、无关文法 diff --git "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter4 \350\257\255\344\271\211\345\210\206\346\236\220.md" "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter4 \350\257\255\344\271\211\345\210\206\346\236\220.md" index ba1a355bc..7e40746ec 100644 --- "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter4 \350\257\255\344\271\211\345\210\206\346\236\220.md" +++ "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter4 \350\257\255\344\271\211\345\210\206\346\236\220.md" @@ -1,13 +1,22 @@ --- -name: Chapter4 语义分析 -icon: edit -date: 2022-01-01 +title: Chapter4 语义分析 +# cover: /assets/images/cover1.jpg + +icon: page +order: 1 +author: ChiChen +date: 2023-10-11 category: - 笔记 tag: - 笔记/编译原理 +sticky: true +star: false +footer: +copyright: 转载请注明出处 --- + # Chapter4 语义分析 ## 目录 diff --git "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter5 \344\273\243\347\240\201\347\224\237\346\210\220.md" "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter5 \344\273\243\347\240\201\347\224\237\346\210\220.md" index dfaca5da0..bf9691e89 100644 --- "a/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter5 \344\273\243\347\240\201\347\224\237\346\210\220.md" +++ "b/src/zh/posts/\347\274\226\350\257\221\345\216\237\347\220\206/Chapter5 \344\273\243\347\240\201\347\224\237\346\210\220.md" @@ -1,13 +1,22 @@ --- -name: Chapter5 代码生成 -icon: edit -date: 2022-01-01 +title: Chapter5 语法生成 +# cover: /assets/images/cover1.jpg + +icon: page +order: 1 +author: ChiChen +date: 2023-10-11 category: - 笔记 tag: - 笔记/编译原理 +sticky: true +star: false +footer: +copyright: 转载请注明出处 --- + # Chapter5 代码生成 ## 介绍 diff --git a/src/zh/slides.md b/src/zh/slides.md deleted file mode 100644 index 8e34803b2..000000000 --- a/src/zh/slides.md +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: 幻灯片页 -icon: slides -layout: Slide ---- - - - -@slidestart - - - -## 幻灯片演示 - - - -一个简单的幻灯片演示与各种小贴士。 - - - -> 作者 Mr.Hope. 请滚动鼠标滚轮进入下一页 - ---- - -## 标注幻灯片 - - - -[👇](#/1/1) - --- - -## 标注幻灯片 - - - -使用 `---` 标注水平幻灯片 - - - -在水平幻灯片中使用 `--` 分割垂直幻灯片 - - - -使用 `` 在幻灯片上添加属性 - - - -使用 `` 在前一个 HTML 元素上添加属性 - - - ---- - - - -## Markdown - - - -你可以在幻灯片中使用 Markdown 语法的各种标记. - - - --- - - - -## Markdown - -你可以在幻灯片中使用 Markdown 语法的各种标记. - -### 这是一个 H3 - -标题默认会自动转换为大写。 - -这是一个有着 **粗体**, _斜体_, ~~删除线~~ 文字并包含 [一个链接](https://mrhope.site) 的段落,并且它会自动换行。所以你无需担心它的长度。 - --- - - - -## Markdown - -你可以在幻灯片中使用 Markdown 语法的各种标记. - -列表默认为 `inline-block` - -- 项目 -- 项目 -- 项目 - -1. 项目 1 -1. 项目 2 -1. 项目 3 - --- - - - -## Markdown - -你可以在幻灯片中使用 Markdown 语法的各种标记. - -在你启用 `highlight` 插件后,代码块会自动高亮。 - -```js -const a = 1; -``` - --- - - - -## Markdown - -你可以在幻灯片中使用 Markdown 语法的各种标记. - -在你启用 `math` 插件后,你也可以使用 TEX 格式使用数学公式。 - -$$ -J(\theta_0,\theta_1) = \sum_{i=0} -$$ - --- - - - -## Markdown - -你可以在幻灯片中使用 Markdown 语法的各种标记. - -⚠**请注意**: 表格和分割线,以及所有不在 Markdown 标准语法中的内容均不受支持。 - ---- - - - -## 布局 - - - --- - - - -## 布局 - - - -👆 `r-fit-text` class 会让文字在不超出幻灯片范围的情况下尽可能大。 - --- - - - -## 布局 - -![Logo](/logo.svg) - - - -👆 `r-stretch` class 帮助你控制注入图片或视频的大小,使它们填充满幻灯片垂直方向上的剩余空间。 - --- - - - -## 布局 - -### 背景 - -你可以通过向特定幻灯片添加 `data-background` 属性自定义幻灯片背景. - ---- - - - -## 动画片段 - - - --- - - - -## 动画片段 - - - -动画片段用于高亮或显隐幻灯片中的元素。 - -你需要在元素上添加 `fragment` 和动画 class。 - --- - - - -## 动画片段 - -### 动画 class - -- `fade-in` - - -- `fade-out` - - -- `fade-up` - - - - -- `fade-down` - - -- `fade-left` - - -- `fade-right` - - - - -- `fade-in-then-out` - - -- `fade-in-then-semi-out` - - --- - - - -## 动画片段 - -### 动画 class - -- `grow` - - -- `shrink` - - -- `strike` - - - - -- `highlight-red` - - -- `highlight-green` - - -- `highlight-blue` - - - - -- `highlight-current-red` - - -- `highlight-current-green` - - -- `highlight-current-blue` - - --- - - - -## 动画片段 - -### 多个动画片段 - -你可以按照顺序包裹一个 HTML 元素使其拥有多个动画片段 - - - - - 渐入 > 变红 > 渐出 - - - - --- - - - -## 动画片段 - -### 顺序 - -你可以使用 `data-fragment-index` 属性改变元素的动画顺序。 - -不同元素可以有相同的动画顺序。 - -- 最后显示 - - -- 第二个显示 - - - - -- 第一个显示 - - -- 第二个显示 - - ---- - - - -## 渐变 - - - --- - - - -## 渐变 - - - -Transition 可以通过配置中的 `transition` 选项全局设置,也可以通过在特定幻灯片添加 `data-transition` 属性局部设置. - -可能的值: - -- none -- fade -- slide - - - -- convex -- concave -- zoom - --- - - - -## 渐变 - - - -### 过渡动画 - -你可以在相邻的幻灯片上添加 `data-auto-animate` 使相同的 HTML 元素产生过渡动画效果。 - ---- - - - -## 功能 - - - --- - - - -## 功能 - - - -### 代码 - -通过启用 `highlight` 插件,你可以对代码块进行高亮。 - -你可以使用 `[a-b|c-d]` 语法来分布高亮特定行。 - -```js [1-2|3|4] -let a = 1; -let b = 2; -let c = (x) => 1 + 2 + x; -c(3); -``` - --- - - - -## 功能 - - - -### 预览模式 - -按下 `Esc` 或 `O` 即可在幻灯片获得焦点时进入预览模式。 - --- - - - -## 功能 - - - -### 全屏模式 - -按下 `F` 或 `F11` 即可在幻灯片获得焦点时进入全屏模式。 - --- - - - -## 功能 - - - -### 缩放 - -按下 `alt` (Linux 上使用 `ctrl`) 的同时点击幻灯片的任何元素,即可以向此元素进行放大。 - -再次点击即可缩小。 - ---- - - - -## 结束 - -@slideend