Skip to content

Commit dc457a8

Browse files
committed
resolve issue with no empty spaces at end
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent b547186 commit dc457a8

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/utils/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ type ParseParams = {
141141
};
142142

143143
export function parse(params: ParseParams): any {
144-
const mdContent: TutorialFrame = parseMdContent(params.text);
144+
const mdContent: TutorialFrame = parseMdContent(params.text + "\n\n");
145145

146146
const parsed: Partial<T.Tutorial> = {
147147
version: params.skeleton.version,

tests/parse.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ The first step
11891189
expect(result.levels).toEqual(expected.levels);
11901190
});
11911191

1192-
it("should parse a single hint", () => {
1192+
it("should parse without spaces at the end", () => {
11931193
const md = `# Title
11941194
11951195
Description.
@@ -1204,9 +1204,7 @@ The first step
12041204
12051205
#### HINTS
12061206
1207-
- A test with a \`backtick\`
1208-
1209-
`;
1207+
- A test with a \`backtick\``;
12101208
const skeleton = {
12111209
levels: [
12121210
{
@@ -1222,9 +1220,7 @@ The first step
12221220
const result = parse({
12231221
text: md,
12241222
skeleton,
1225-
commits: {
1226-
"1.1:T": ["abcdef1", "123456789"],
1227-
},
1223+
commits: {},
12281224
});
12291225
const expected = {
12301226
summary: {
@@ -1241,7 +1237,7 @@ The first step
12411237
id: "1.1",
12421238
content: "The first step",
12431239
setup: {
1244-
commits: ["abcdef1", "123456789"],
1240+
commits: [],
12451241
},
12461242
hints: ["A test with a `backtick`"],
12471243
},

0 commit comments

Comments
 (0)