Skip to content

Commit 0936371

Browse files
committed
fix: update edtion typo to edition
1 parent 50ae6db commit 0936371

File tree

17 files changed

+50
-50
lines changed

17 files changed

+50
-50
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Markdown 文档的命名须遵循以下规范:
3434
- 文件名必须以 `小写英文字母` 打头,且不得以 `-``_` 结尾
3535
- 文档格式的后缀为 `.md`
3636

37-
> 特别的,我们还支持在文件名中使用 `@ 字符后跟数字` 来表示文档版本,具体说明可见[文档版本设计说明](./doc/md-edtion.md)
37+
> 特别的,我们还支持在文件名中使用 `@ 字符后跟数字` 来表示文档版本,具体说明可见[文档版本设计说明](./doc/md-edition.md)
3838
3939
### 如何编译文档并预览?
4040

doc/api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ API 解释说明。
5050
"lang": "zh",
5151
"file": "test",
5252
"options": {
53-
"edtion": 3,
53+
"edition": 3,
5454
"sections": [
5555
"awards"
5656
]
@@ -63,7 +63,7 @@ API 解释说明。
6363
- `lang` 表示要获取的文档的语言。
6464
- `file` 表示要获取的文档的标识符,这个 `file` 即是文档的文件名。
6565
- `options` 可选参数,字段如下:
66-
- `edtion` 表示要获取的文档的版本,如果传入了 `edtion`,则 `edtion` 必须为正整数(且小于 2^53)。
66+
- `edition` 表示要获取的文档的版本,如果传入了 `edition`,则 `edition` 必须为正整数(且小于 2^53)。
6767
- `sections` 表示要获取文档的哪几部分,这里的 `section` 要和制定文档中的 `data-section` 属性一致。如果不传 `sections``sections` 为空数组,则表示获取整篇文档。
6868

6969
**返回值**
@@ -76,15 +76,15 @@ API 解释说明。
7676
"lang": "zh",
7777
"file": "test",
7878
"options": {
79-
"edtion": 3,
79+
"edition": 3,
8080
"sections": [
8181
"awards"
8282
]
8383
}
8484
},
8585
"sourceHash": "07f275d35f95d9e2ed11edec4447811163ca66de",
8686
"lang": "zh",
87-
"edtion": 3,
87+
"edition": 3,
8888
"info": {
8989
"title": "海边的曼彻斯特",
9090
"desc": "影片讲述了李·钱德勒的哥哥因病去世之后,他作为监护人照顾侄子的故事",
@@ -103,6 +103,6 @@ API 解释说明。
103103
- `criterion` 表示请求信息。
104104
- `sourceHash` 表示文档源版本的提交哈希值,如果文档源没有版本哈希值,则返回 `null`
105105
- `lang` 表示文档语言。
106-
- `edtion` 表示文档版本,如果文档没有版本,则返回 `null`
106+
- `edition` 表示文档版本,如果文档没有版本,则返回 `null`
107107
- `info` 表示文档信息,这部分数据来源于 Markdown 文档的 Front Matter 数据。
108108
- `data` 表示文档内容。
File renamed without changes.

md/en/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "张丁丁",
77
"created_at": "2022-08-05",
88
"updated_at": "2022-08-08",
9-
"edtion": "1",
9+
"edition": "1",
1010
"tags": ["tag1", "tag2"],
1111
"about": "https://github.com/jonschlinkert/gray-matter"
1212
}

md/zh/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "张丁丁",
77
"created_at": "2022-08-05",
88
"updated_at": "2022-08-08",
9-
"edtion": "1",
9+
"edition": "1",
1010
"tags": ["tag1", "tag2"],
1111
"about": "https://github.com/jonschlinkert/gray-matter"
1212
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markdoc",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "parse markdown to html",
55
"exports": "./src/index.js",
66
"scripts": {

public/output/tutorial/en/test@3.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
.markdown-body {
1111
padding: 15px;
1212
}
13-
}</style></head><body><div id="root" class="root-container" data-source="tutorial" data-source-hash="07f275d35f95d9e2ed11edec4447811163ca66de" data-lang="en" data-edtion="3"><div id="md" class="markdown-body"><h1>Manchester by the Sea V3</h1><p><img alt="Theatrical release poster" src="https://lovdin.com/images/manchester-by-the-sea-a9954c1.jpg"></p><p><a href="https://www.imdb.com/title/tt4034228/"><strong>Manchester by the Sea V3</strong></a> is a 2016 American psychological drama film written and directed by Kenneth Lonergan. Centered around the themes of depression, guilt, grief, responsibility, dysfunctional families, and post-traumatic stress disorder, the plot follows a depressed and grief-stricken man who was accidentally responsible for the deaths of his three children and must care for his teenage nephew after the death of his brother.</p><p data-keywords="Casey_Affleck Lucas_Hedges Kyle_Chandler Michelle_Williams">The film stars <em>Casey Affleck</em>, <em>Lucas Hedges</em>, <em>Kyle Chandler</em>, <em>Michelle Williams</em> and more.</p><div data-section="main"><h2>Cast</h2><div data-section="cast"><ul><li>Casey Affleck as Lee Chandler</li><li>Michelle Williams as Randi</li><li>Lucas Hedges as Patrick Chandler</li><li>Kyle Chandler as Joe Chandler</li><li>C. J. Wilson as George</li><li>Gretchen Mol as Elise</li></ul></div><div data-section="awards"><h2>Awards</h2><p>After premiering at the Sundance Film Festival on January 23, 2016, the film was quickly distributed by Amazon Studios and is scheduled for a limited release in the U.S. on November 18, 2016, with a wide release scheduled for December 16. With a production budget of $8.5 million, the film grossed over $62 million worldwide.</p><p>The film was released to critical acclaim and won numerous awards. The film was named by many critics as one of the best films of 2016, winning Best Actor and Best Original Screenplay at the 89th Academy Awards, Best Actor at the 74th Golden Globe Awards, and Best Actor and Best Original Screenplay at the 70th BAFTA Awards.</p></div><h2>Themes</h2><p id="themes">The film is a treatment of profound grief from which it is difficult or impossible to recover.</p></div><h2 id="reference">Reference</h2><ul><li><a href="https://movie.douban.com/subject/25980443/">Douban</a></li><li><a href="https://www.imdb.com/title/tt4034228/">IMDB</a></li><li><a href="https://en.wikipedia.org/wiki/Manchester_by_the_Sea_(film)">Wikipedia</a></li></ul></div></div><script type="module">import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/es/highlight.min.js';
13+
}</style></head><body><div id="root" class="root-container" data-source="tutorial" data-source-hash="07f275d35f95d9e2ed11edec4447811163ca66de" data-lang="en" data-edition="3"><div id="md" class="markdown-body"><h1>Manchester by the Sea V3</h1><p><img alt="Theatrical release poster" src="https://lovdin.com/images/manchester-by-the-sea-a9954c1.jpg"></p><p><a href="https://www.imdb.com/title/tt4034228/"><strong>Manchester by the Sea V3</strong></a> is a 2016 American psychological drama film written and directed by Kenneth Lonergan. Centered around the themes of depression, guilt, grief, responsibility, dysfunctional families, and post-traumatic stress disorder, the plot follows a depressed and grief-stricken man who was accidentally responsible for the deaths of his three children and must care for his teenage nephew after the death of his brother.</p><p data-keywords="Casey_Affleck Lucas_Hedges Kyle_Chandler Michelle_Williams">The film stars <em>Casey Affleck</em>, <em>Lucas Hedges</em>, <em>Kyle Chandler</em>, <em>Michelle Williams</em> and more.</p><div data-section="main"><h2>Cast</h2><div data-section="cast"><ul><li>Casey Affleck as Lee Chandler</li><li>Michelle Williams as Randi</li><li>Lucas Hedges as Patrick Chandler</li><li>Kyle Chandler as Joe Chandler</li><li>C. J. Wilson as George</li><li>Gretchen Mol as Elise</li></ul></div><div data-section="awards"><h2>Awards</h2><p>After premiering at the Sundance Film Festival on January 23, 2016, the film was quickly distributed by Amazon Studios and is scheduled for a limited release in the U.S. on November 18, 2016, with a wide release scheduled for December 16. With a production budget of $8.5 million, the film grossed over $62 million worldwide.</p><p>The film was released to critical acclaim and won numerous awards. The film was named by many critics as one of the best films of 2016, winning Best Actor and Best Original Screenplay at the 89th Academy Awards, Best Actor at the 74th Golden Globe Awards, and Best Actor and Best Original Screenplay at the 70th BAFTA Awards.</p></div><h2>Themes</h2><p id="themes">The film is a treatment of profound grief from which it is difficult or impossible to recover.</p></div><h2 id="reference">Reference</h2><ul><li><a href="https://movie.douban.com/subject/25980443/">Douban</a></li><li><a href="https://www.imdb.com/title/tt4034228/">IMDB</a></li><li><a href="https://en.wikipedia.org/wiki/Manchester_by_the_Sea_(film)">Wikipedia</a></li></ul></div></div><script type="module">import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/es/highlight.min.js';
1414
hljs.highlightAll();</script></body></html>

public/output/tutorial/zh/test@3.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
.markdown-body {
1111
padding: 15px;
1212
}
13-
}</style></head><body><div id="root" class="root-container" data-source="tutorial" data-source-hash="07f275d35f95d9e2ed11edec4447811163ca66de" data-lang="zh" data-edtion="3"><div id="md" class="markdown-body"><h1>海边的曼彻斯特 V3</h1><p><img alt="海报" src="https://lovdin.com/images/manchester-by-the-sea-a9954c1.jpg"></p><p><a href="https://movie.douban.com/subject/25980443/"><strong>海边的曼彻斯特 V3</strong></a>是肯尼斯·罗纳根执导的剧情片,于 2016 年 11 月 18 日在美国上映。影片讲述了李·钱德勒的哥哥因病去世之后,他作为监护人照顾侄子的故事。</p><p data-keywords="Casey_Affleck Lucas_Hedges Kyle_Chandler Michelle_Williams">本片由<em>卡西·阿弗莱克</em><em>卢卡斯·赫奇斯</em><em>凯尔·钱德勒</em><em>米歇尔·威廉姆斯</em>等主演。</p><div data-section="main"><h2>演员表</h2><div data-section="cast"><ul><li>卡西·阿弗莱克 饰 李·钱德勒</li><li>米歇尔·威廉姆斯 饰 兰迪</li><li>卢卡斯·赫奇斯 饰 帕特里克</li><li>凯尔·钱德勒 饰 乔·钱德勒</li><li>C·J·威尔逊 饰 乔治</li><li>格瑞辰·摩尔 饰 爱丽丝</li></ul></div><div data-section="awards"><h2>奖项</h2><p>电影于 2016 年 1 月 23 日的圣丹斯电影节上首映后,很快被亚马逊工作室(Amazon Studios)分发,并订于 2016 年 11 月 18 日于美国作有限上映,并定于 12 月 16 日广泛上映。该片以 850 万美元的制作预算,全球收益总得超过 6200 万美元。</p><p>影片上映后获得一致好评,并赢得无数奖项。这部电影被许多评论家列为 2016 年最佳电影之一,获得第 89 届奥斯卡金像奖最佳男主角、最佳原创剧本,第 74 届金球奖最佳男主角奖,第 70 届英国电影学院奖最佳男主角和最佳原创剧本。</p></div><h2>主题</h2><p id="themes">本片被认为是对一种无法治愈的深切悲痛的治疗,探讨和展示人们如何面对无法放下的往事。</p></div><h2 id="reference">参考链接</h2><ul><li><a href="https://movie.douban.com/subject/25980443/">豆瓣电影</a></li><li><a href="https://www.imdb.com/title/tt4034228/">IMDB</a></li><li><a href="https://zh.wikipedia.org/wiki/%E6%B5%B7%E9%82%8A%E7%9A%84%E6%9B%BC%E5%BE%B9%E6%96%AF%E7%89%B9">维基百科</a></li><li><a href="https://baike.baidu.com/item/%E6%B5%B7%E8%BE%B9%E7%9A%84%E6%9B%BC%E5%BD%BB%E6%96%AF%E7%89%B9/17594243">百度百科</a></li></ul></div></div><script type="module">import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/es/highlight.min.js';
13+
}</style></head><body><div id="root" class="root-container" data-source="tutorial" data-source-hash="07f275d35f95d9e2ed11edec4447811163ca66de" data-lang="zh" data-edition="3"><div id="md" class="markdown-body"><h1>海边的曼彻斯特 V3</h1><p><img alt="海报" src="https://lovdin.com/images/manchester-by-the-sea-a9954c1.jpg"></p><p><a href="https://movie.douban.com/subject/25980443/"><strong>海边的曼彻斯特 V3</strong></a>是肯尼斯·罗纳根执导的剧情片,于 2016 年 11 月 18 日在美国上映。影片讲述了李·钱德勒的哥哥因病去世之后,他作为监护人照顾侄子的故事。</p><p data-keywords="Casey_Affleck Lucas_Hedges Kyle_Chandler Michelle_Williams">本片由<em>卡西·阿弗莱克</em><em>卢卡斯·赫奇斯</em><em>凯尔·钱德勒</em><em>米歇尔·威廉姆斯</em>等主演。</p><div data-section="main"><h2>演员表</h2><div data-section="cast"><ul><li>卡西·阿弗莱克 饰 李·钱德勒</li><li>米歇尔·威廉姆斯 饰 兰迪</li><li>卢卡斯·赫奇斯 饰 帕特里克</li><li>凯尔·钱德勒 饰 乔·钱德勒</li><li>C·J·威尔逊 饰 乔治</li><li>格瑞辰·摩尔 饰 爱丽丝</li></ul></div><div data-section="awards"><h2>奖项</h2><p>电影于 2016 年 1 月 23 日的圣丹斯电影节上首映后,很快被亚马逊工作室(Amazon Studios)分发,并订于 2016 年 11 月 18 日于美国作有限上映,并定于 12 月 16 日广泛上映。该片以 850 万美元的制作预算,全球收益总得超过 6200 万美元。</p><p>影片上映后获得一致好评,并赢得无数奖项。这部电影被许多评论家列为 2016 年最佳电影之一,获得第 89 届奥斯卡金像奖最佳男主角、最佳原创剧本,第 74 届金球奖最佳男主角奖,第 70 届英国电影学院奖最佳男主角和最佳原创剧本。</p></div><h2>主题</h2><p id="themes">本片被认为是对一种无法治愈的深切悲痛的治疗,探讨和展示人们如何面对无法放下的往事。</p></div><h2 id="reference">参考链接</h2><ul><li><a href="https://movie.douban.com/subject/25980443/">豆瓣电影</a></li><li><a href="https://www.imdb.com/title/tt4034228/">IMDB</a></li><li><a href="https://zh.wikipedia.org/wiki/%E6%B5%B7%E9%82%8A%E7%9A%84%E6%9B%BC%E5%BE%B9%E6%96%AF%E7%89%B9">维基百科</a></li><li><a href="https://baike.baidu.com/item/%E6%B5%B7%E8%BE%B9%E7%9A%84%E6%9B%BC%E5%BD%BB%E6%96%AF%E7%89%B9/17594243">百度百科</a></li></ul></div></div><script type="module">import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/es/highlight.min.js';
1414
hljs.highlightAll();</script></body></html>

src/misc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export function isDataAttrNamingValid(naming) {
2121
return (/^[a-z]([a-z]*\-?[a-z])*$/).test(naming);
2222
}
2323

24-
// 合法的文件 edtion 必须为正整数(且小于 2^53)
25-
export function isFileEdtionValid(edtion) {
26-
return Number.isSafeInteger(edtion) && edtion >= 1;
24+
// 合法的文件 edition 必须为正整数(且小于 2^53)
25+
export function isFileEditionValid(edition) {
26+
return Number.isSafeInteger(edition) && edition >= 1;
2727
}
2828

2929
// 合法的目录名仅可由英文字符、连字符、下划线组成,且必须以英文字符开头和结尾
@@ -119,13 +119,13 @@ export function splitOnce(str, separator) {
119119
}
120120

121121
// 关于文件版本的定义规则请见「文档版本设计说明」
122-
export function deriveFileEdtionFromFileName(fileName) {
122+
export function deriveFileEditionFromFileName(fileName) {
123123
if (typeof fileName !== "string") {
124124
return null;
125125
}
126-
const [, fileEdtionStr] = splitOnce(fileName, "@");
127-
const fileEdtion = Number(fileEdtionStr);
128-
return isFileEdtionValid(fileEdtion) ? fileEdtion : null;
126+
const [, fileEditionStr] = splitOnce(fileName, "@");
127+
const fileEdition = Number(fileEditionStr);
128+
return isFileEditionValid(fileEdition) ? fileEdition : null;
129129
}
130130

131131
// 关于文件目录的定义规则请见「README」

src/parser/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
readFilePathListSync,
88
isFileDirValid,
99
deriveFileSourceAndLangFromFileDir,
10-
deriveFileEdtionFromFileName,
10+
deriveFileEditionFromFileName,
1111
} from "../misc.js";
1212

1313
import { readAndParseFrontMatter } from "./front-matter.js";
@@ -66,7 +66,7 @@ function parseMarkdownDocs(markdownDocs, options = {
6666
const { relativePath, sourceHash, data } = item;
6767
const { dir, name } = path.parse(relativePath);
6868
const [fileSource, fileLang] = deriveFileSourceAndLangFromFileDir(dir);
69-
const fileEdtion = deriveFileEdtionFromFileName(name);
69+
const fileEdition = deriveFileEditionFromFileName(name);
7070

7171
// parse markdown
7272
let html = parseMarkdown(data.content);
@@ -80,7 +80,7 @@ function parseMarkdownDocs(markdownDocs, options = {
8080
source: fileSource,
8181
"source-hash": sourceHash,
8282
lang: fileLang,
83-
edtion: fileEdtion,
83+
edition: fileEdition,
8484
});
8585
}
8686
// minify html
@@ -93,7 +93,7 @@ function parseMarkdownDocs(markdownDocs, options = {
9393
sourceHash,
9494
source: fileSource,
9595
lang: fileLang,
96-
edtion: fileEdtion,
96+
edition: fileEdition,
9797
info: data.data,
9898
data: html,
9999
});

src/server/controllers/docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function retrieveDocs(criteria, htmlDocs) {
1717
criterion: item,
1818
sourceHash: doc.sourceHash,
1919
lang: doc.lang,
20-
edtion: doc.edtion,
20+
edition: doc.edition,
2121
info: doc.info,
2222
data: queryFragmentsFromHtmlDoc(doc.data, item.options?.sections),
2323
});

src/server/utils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isFileEdtionValid, isFileDirValid } from "../misc.js";
1+
import { isFileEditionValid, isFileDirValid } from "../misc.js";
22

33
export function deriveMarkdownSourceVersionInfoFromManifest(markdownManifest) {
44
if (!Array.isArray(markdownManifest) || markdownManifest.length < 1) {
@@ -13,24 +13,24 @@ export function deriveMarkdownSourceVersionInfoFromManifest(markdownManifest) {
1313
return versionInfo;
1414
}
1515

16-
export function deriveHTMLDocKeyFromDocInfo(source, lang, file, edtion) {
16+
export function deriveHTMLDocKeyFromDocInfo(source, lang, file, edition) {
1717
if (!source || !lang || !file) {
1818
return null;
1919
}
2020
let docKey = `${source}/${lang}/${file}`;
21-
if (edtion === undefined || edtion === null) {
21+
if (edition === undefined || edition === null) {
2222
docKey += ".html";
2323
return docKey;
2424
}
25-
if (isFileEdtionValid(edtion)) {
26-
docKey += `@${edtion}.html`;
25+
if (isFileEditionValid(edition)) {
26+
docKey += `@${edition}.html`;
2727
return docKey;
2828
}
2929
return null;
3030
}
3131

3232
export function getHTMLDocByDocInfo(htmlDocs, docInfo) {
33-
const docKey = deriveHTMLDocKeyFromDocInfo(docInfo.source, docInfo.lang, docInfo.file, docInfo.options?.edtion);
33+
const docKey = deriveHTMLDocKeyFromDocInfo(docInfo.source, docInfo.lang, docInfo.file, docInfo.options?.edition);
3434
if (!docKey) {
3535
return null;
3636
}

0 commit comments

Comments
 (0)