Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/markdown as master#48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 17 commits intomasterfromfeature/markdown-as-master
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
17 commits
Select commitHold shift + click to select a range
504103a
setup tests
ShMcKJun 21, 2020
8ba4877
update markdown validation
ShMcKJun 21, 2020
67bdfd7
test/update commit order
ShMcKJun 21, 2020
8af3bf6
update parser progress
ShMcKJun 21, 2020
4bb28b9
passing step tests
ShMcKJun 21, 2020
b0d2369
complete parser tests
ShMcKJun 21, 2020
5dd69ce
remove commit validation in skeleton
ShMcKJun 21, 2020
791212e
make step solution optional
ShMcKJun 21, 2020
67b0195
fix multiple commit order issue
ShMcKJun 21, 2020
8558b8e
fix step commit parsing
ShMcKJun 21, 2020
692cb66
setup commit parsing for testing
ShMcKJun 23, 2020
deba9b3
parse commits with tests
ShMcKJun 23, 2020
f6159c4
validate commits
ShMcKJun 24, 2020
0765174
validate step has tests && tests before solution
ShMcKJun 24, 2020
1b7d20b
update step ids
ShMcKJun 24, 2020
325ba8b
update docs for new build format
ShMcKJun 24, 2020
aa745f9
prepare release
ShMcKJun 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
update markdown validation
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 21, 2020
commit8ba48775ffa5c548f68426146abf0c01a0f062da
14 changes: 7 additions & 7 deletionssrc/utils/validateMarkdown.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,23 +24,23 @@ const validations: Validation[] = [
},
},
{
message: "should have a level `##` with a format of `L[0-9]+`",
message: "should have a level `##` with a format of `[0-9]+.`",
validate: (t) => {
const headers = t.match(/^#{2}\s(.+)$/gm) || [];
for (const header of headers) {
if (!header.match(/^#{2}\s(L\d+)\s(.+)$/)) {
if (!header.match(/^#{2}\s(\d+\.)\s(.+)$/)) {
return false;
}
}
return true;
},
},
{
message: "should have a step `###` with a format of `L[0-9]+S[0-9]+`",
message: "should have a step `###` with a format of `[0-9].[0-9]+`",
validate: (t) => {
const headers = t.match(/^#{3}\s(.+)$/gm) || [];
for (const header of headers) {
if (!header.match(/^#{3}\s(L\d+)S\d+/)) {
if (!header.match(/^#{3}\s(\d+\.\d+)/)) {
return false;
}
}
Expand All@@ -60,9 +60,9 @@ export function validateMarkdown(md: string): boolean {
for (const v of validations) {
if (!v.validate(text)) {
valid = false;
if (process.env.NODE_ENV !== "test") {
console.warn(v.message);
}
//if (process.env.NODE_ENV !== "test") {
console.warn(v.message);
//}
}
}

Expand Down
21 changes: 11 additions & 10 deletionstests/markdown.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@ describe("validate markdown", () => {
const md = `
Description.

## Put Level's title here
##1.Put Level's title here

> Level's summary: a short description of the level's content in one line.

Expand All@@ -19,7 +19,7 @@ Description.

# Another Title

## Put Level's title here
##1.Put Level's title here

> Level's summary: a short description of the level's content in one line.

Expand All@@ -29,7 +29,7 @@ Some text that describes the level`;
Description.


## Put Level's title here
##1.Put Level's title here

> Level's summary: a short description of the level's content in one line.

Expand All@@ -45,7 +45,7 @@ Some text that describes the level
it("should return false if missing a summary description", () => {
const md = `# A Title

## Put Level's title here
##1.Put Level's title here

> Level's summary: a short description of the level's content in one line.

Expand DownExpand Up@@ -79,24 +79,25 @@ A description

Some text that describes the level

###A Step
###Missing step id

First step
`;
expect(validateMarkdown(md)).toBe(false);
});

it("should return true for valid markdown", () => {
const md = `# Title

Description.

## Put Level's title here
##1.Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level

###Step1
###1.1

First Step`;
expect(validateMarkdown(md)).toBe(true);
Expand All@@ -114,19 +115,19 @@ Should not be a problem
\`\`\`


## Put Level's title here
##1.Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level

\`\`\`
## Another Level in markdown
##2.Another Level in markdown

Should not be an issue
\`\`\`

###Step1
###1.1

First Step`;
expect(validateMarkdown(md)).toBe(true);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp