X Tutup
Skip to content

Commit a5fa2fb

Browse files
committed
fix(markdown-legacy): fix new line encoding on Windows
kramed’s `annotate` does not normalize line encoding. It break `{% raw %}` escape feature. So add normalize line encoding before pass source to annotate
1 parent 2d5e133 commit a5fa2fb

File tree

29 files changed

+1190
-262
lines changed

29 files changed

+1190
-262
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Page parsing conrefs.md and prepare test: conrefs.md 1`] = `
4+
"# Content References
5+
6+
Content referencing (conref) is a convenient mechanism to reuse content from other files or books.
7+
8+
### Importing local files
9+
10+
Importing an other file's content is easy using the {% raw %}\`include\`{% endraw %} tag:
11+
12+
{% raw %}\`\`\`
13+
{% include \\"./test.md\\" %}
14+
\`\`\`
15+
{% endraw %}
16+
### Importing file from another book
17+
18+
HonKit can also resolve the include path by using git:
19+
20+
{% raw %}\`\`\`
21+
{% include \\"git+https://github.com/GitbookIO/documentation.git/README.md#0.0.1\\" %}
22+
\`\`\`
23+
{% endraw %}
24+
The format of git url is:
25+
26+
{% raw %}\`\`\`
27+
git+https://user@hostname/owner/project.git/file#commit-ish
28+
\`\`\`
29+
{% endraw %}
30+
The real git url part should finish with {% raw %}\`.git\`{% endraw %}, the filename to import is extracted after the {% raw %}\`.git\`{% endraw %} till the fragment of the url.
31+
32+
The {% raw %}\`commit-ish\`{% endraw %} can be any tag, sha, or branch which can be supplied as an argument to {% raw %}\`git checkout\`{% endraw %}. The default is {% raw %}\`master\`{% endraw %}.
33+
34+
### Inheritance
35+
36+
Template inheritance is a way to make it easy to reuse templates. When writing a template, you can define \\"blocks\\" that child templates can override. The inheritance chain can be as long as you like.
37+
38+
{% raw %}\`block\`{% endraw %} defines a section on the template and identifies it with a name. Base templates can specify blocks and child templates can override them with new content.
39+
40+
{% raw %}\`\`\`
41+
{% extends \\"./mypage.md\\" %}
42+
43+
{% block pageContent %}
44+
# This is my page content
45+
{% endblock %}
46+
\`\`\`
47+
{% endraw %}
48+
In the file {% raw %}\`mypage.md\`{% endraw %}, you should specify the blocks that can be extended:
49+
50+
{% raw %}\`\`\`
51+
{% block pageContent %}
52+
This is the default content
53+
{% endblock %}
54+
55+
# License
56+
57+
{% include \\"./LICENSE\\" %}
58+
\`\`\`
59+
{% endraw %}"
60+
`;
61+
62+
exports[`Page parsing conrefs.md inline and prepare test: conrefs.md inline 1`] = `
63+
"# Content References
64+
65+
Content referencing (conref) is a convenient mechanism to reuse content from other files or books.
66+
67+
### Importing local files
68+
69+
Importing an other file's content is easy using the {% raw %}\`include\`{% endraw %} tag:
70+
71+
{% raw %}\`\`\`
72+
{% include \\"./test.md\\" %}
73+
\`\`\`
74+
{% endraw %}
75+
### Importing file from another book
76+
77+
HonKit can also resolve the include path by using git:
78+
79+
{% raw %}\`\`\`
80+
{% include \\"git+https://github.com/GitbookIO/documentation.git/README.md#0.0.1\\" %}
81+
\`\`\`
82+
{% endraw %}
83+
The format of git url is:
84+
85+
{% raw %}\`\`\`
86+
git+https://user@hostname/owner/project.git/file#commit-ish
87+
\`\`\`
88+
{% endraw %}
89+
The real git url part should finish with {% raw %}\`.git\`{% endraw %}, the filename to import is extracted after the {% raw %}\`.git\`{% endraw %} till the fragment of the url.
90+
91+
The {% raw %}\`commit-ish\`{% endraw %} can be any tag, sha, or branch which can be supplied as an argument to {% raw %}\`git checkout\`{% endraw %}. The default is {% raw %}\`master\`{% endraw %}.
92+
93+
### Inheritance
94+
95+
Template inheritance is a way to make it easy to reuse templates. When writing a template, you can define \\"blocks\\" that child templates can override. The inheritance chain can be as long as you like.
96+
97+
{% raw %}\`block\`{% endraw %} defines a section on the template and identifies it with a name. Base templates can specify blocks and child templates can override them with new content.
98+
99+
{% raw %}\`\`\`
100+
{% extends \\"./mypage.md\\" %}
101+
102+
{% block pageContent %}
103+
# This is my page content
104+
{% endblock %}
105+
\`\`\`
106+
{% endraw %}
107+
In the file {% raw %}\`mypage.md\`{% endraw %}, you should specify the blocks that can be extended:
108+
109+
{% raw %}\`\`\`
110+
{% block pageContent %}
111+
This is the default content
112+
{% endblock %}
113+
114+
# License
115+
116+
{% include \\"./LICENSE\\" %}
117+
\`\`\`
118+
{% endraw %}"
119+
`;

packages/@honkit/markdown-legacy/test/fixtures/GLOSSARY.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/GLOSSARY.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/LANGS.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/LANGS.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/PAGE.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/PAGE.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/README.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/README.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/SUMMARY.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/SUMMARY.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/SUMMARY_EMPTY.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/SUMMARY_EMPTY.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/SUMMARY_PARTS.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/SUMMARY_PARTS.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/SUMMARY_SUBLIST.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/SUMMARY_SUBLIST.md

File renamed without changes.

packages/@honkit/markdown-legacy/test/fixtures/SUMMARY_WHITESPACE.md renamed to packages/@honkit/markdown-legacy/__tests__/fixtures/SUMMARY_WHITESPACE.md

File renamed without changes.

0 commit comments

Comments
 (0)
X Tutup