From 98063a51f02b1c2c7fdf512213a02c56b7a76acc Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Sun, 12 Mar 2023 23:59:52 +0800 Subject: [PATCH 1/9] Remove include for examples in questions and attributes --- docs/userGuide/syntax/attributes.md | 8 +++++++- docs/userGuide/syntax/questions.md | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/userGuide/syntax/attributes.md b/docs/userGuide/syntax/attributes.md index 59620c0fa3..2954b88bfc 100644 --- a/docs/userGuide/syntax/attributes.md +++ b/docs/userGuide/syntax/attributes.md @@ -62,5 +62,11 @@ don't add a space for **inline**{.text-danger} markdown
- + +* Apply to the list item itself like so {.text-success #list-item-id} + * Curly groups after newlines apply to the closest nested list {.text-danger} +{.bg-light} +* Curly groups two lines after the last line apply to the top most list + +{.alert-info}
diff --git a/docs/userGuide/syntax/questions.md b/docs/userGuide/syntax/questions.md index ccdfbe307c..7f01c74ee6 100644 --- a/docs/userGuide/syntax/questions.md +++ b/docs/userGuide/syntax/questions.md @@ -419,5 +419,10 @@ intro | Slot | `Click start to begin` | Quiz intro markup. Overrides the `intro`
- + +{{ mcqQuestion }} +{{ checkboxQuestion }} +{{ blanksQuestion }} +{{ textQuestion }} +
From 00a562310d7a49fe752e6a617bd8b36e6747d24d Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Tue, 14 Mar 2023 12:41:53 +0800 Subject: [PATCH 2/9] Revert to use includes in attributes and questions --- docs/userGuide/syntax/attributes.md | 8 +------- docs/userGuide/syntax/questions.md | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/docs/userGuide/syntax/attributes.md b/docs/userGuide/syntax/attributes.md index 2954b88bfc..f958a5246a 100644 --- a/docs/userGuide/syntax/attributes.md +++ b/docs/userGuide/syntax/attributes.md @@ -62,11 +62,5 @@ don't add a space for **inline**{.text-danger} markdown
- -* Apply to the list item itself like so {.text-success #list-item-id} - * Curly groups after newlines apply to the closest nested list {.text-danger} -{.bg-light} -* Curly groups two lines after the last line apply to the top most list - -{.alert-info} +
diff --git a/docs/userGuide/syntax/questions.md b/docs/userGuide/syntax/questions.md index 7f01c74ee6..ccdfbe307c 100644 --- a/docs/userGuide/syntax/questions.md +++ b/docs/userGuide/syntax/questions.md @@ -419,10 +419,5 @@ intro | Slot | `Click start to begin` | Quiz intro markup. Overrides the `intro`
- -{{ mcqQuestion }} -{{ checkboxQuestion }} -{{ blanksQuestion }} -{{ textQuestion }} - +
From 4575f598ac8aa1933ccd625ff35a1f6974a96000 Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Tue, 14 Mar 2023 14:01:17 +0800 Subject: [PATCH 3/9] Add markdown processing when hash is provided --- packages/core/src/html/includePanelProcessor.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/html/includePanelProcessor.ts b/packages/core/src/html/includePanelProcessor.ts index ffc6165cc1..fcc3e30f26 100644 --- a/packages/core/src/html/includePanelProcessor.ts +++ b/packages/core/src/html/includePanelProcessor.ts @@ -245,6 +245,9 @@ export function processInclude(node: DomElement, context: Context, pageSources: actualContent = cheerio.html(createErrorNode(node, error) as cheerio.Element); } + if (fsUtil.isMarkdownFileExt(path.extname(actualFilePath))) { + actualContent = renderMdInline(actualContent); + } } if (isTrim) { From ade8b589f544b3a2c7a90fc3a9bcb2503e5980d2 Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Tue, 14 Mar 2023 16:36:14 +0800 Subject: [PATCH 4/9] Remove unecessary trim --- docs/userGuide/syntax/attributes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userGuide/syntax/attributes.md b/docs/userGuide/syntax/attributes.md index f958a5246a..36a3cceaea 100644 --- a/docs/userGuide/syntax/attributes.md +++ b/docs/userGuide/syntax/attributes.md @@ -62,5 +62,5 @@ don't add a space for **inline**{.text-danger} markdown
- +
From d47e434b3f405bcda50a4de9cfef6eed0dffa5eb Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Tue, 14 Mar 2023 19:18:12 +0800 Subject: [PATCH 5/9] Change ordering of markdown rendering --- packages/core/src/html/includePanelProcessor.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/core/src/html/includePanelProcessor.ts b/packages/core/src/html/includePanelProcessor.ts index fcc3e30f26..a959e87e8f 100644 --- a/packages/core/src/html/includePanelProcessor.ts +++ b/packages/core/src/html/includePanelProcessor.ts @@ -225,11 +225,6 @@ export function processInclude(node: DomElement, context: Context, pageSources: } = variableProcessor.renderIncludeFile(actualFilePath, pageSources, node, context, filePath); let actualContent = nunjucksProcessed; - if (fsUtil.isMarkdownFileExt(path.extname(actualFilePath))) { - actualContent = isInline - ? renderMdInline(actualContent) - : renderMd(actualContent); - } // Process sources with or without hash, retrieving and appending // the appropriate children to a wrapped include element @@ -245,9 +240,12 @@ export function processInclude(node: DomElement, context: Context, pageSources: actualContent = cheerio.html(createErrorNode(node, error) as cheerio.Element); } - if (fsUtil.isMarkdownFileExt(path.extname(actualFilePath))) { - actualContent = renderMdInline(actualContent); - } + } + + if (fsUtil.isMarkdownFileExt(path.extname(actualFilePath))) { + actualContent = isInline + ? renderMdInline(actualContent) + : renderMd(actualContent); } if (isTrim) { From 3aaa40a107cb9bc34b1b48eb1552360c45353c7d Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Tue, 14 Mar 2023 19:19:38 +0800 Subject: [PATCH 6/9] Update unit test cases with markdown rendering --- .../unit/html/includePanelProcessor.test.js | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/packages/core/test/unit/html/includePanelProcessor.test.js b/packages/core/test/unit/html/includePanelProcessor.test.js index c65ef78bd9..38ef548df2 100644 --- a/packages/core/test/unit/html/includePanelProcessor.test.js +++ b/packages/core/test/unit/html/includePanelProcessor.test.js @@ -115,7 +115,7 @@ test('includeFile replaces with
', async const expected = [ '

Index

', - '
existing segment
', + '

existing segment

', ].join('\n'); expect(result).toEqual(expected); @@ -197,7 +197,7 @@ test('includeFile replaces with trimmed c const include = [ '# Include', - '
\t\texisting segment\t\t
', + '
\n\nexisting segment\n\n
', ].join('\n'); const json = { @@ -212,7 +212,7 @@ test('includeFile replaces with trimmed c const expected = [ '

Index

', - '
existing segment
', + '

existing segment

', ].join('\n'); expect(result).toEqual(expected); @@ -277,7 +277,7 @@ test('includeFile replaces with
const expected = [ '

Index

', - '
existing segment
', + '

existing segment

', ].join('\n'); expect(result).toEqual(expected); @@ -432,3 +432,36 @@ test('process include with omitFrontmatter should discard included frontmatter d expect(result).toEqual(expectedHtml); expect(nodeProcessor.frontmatter).toEqual(expectedFrontmatter); }); + +test('process include with markdown should render correctly', async () => { + const indexPath = path.resolve('index.md'); + + const index = [ + '# Index', + '', + '', + ].join('\n'); + + const include = [ + '# Include', + '
\n ## existing segment {.text-info}
', + ].join('\n'); + + const json = { + 'index.md': index, + 'include.md': include, + }; + + fs.vol.fromJSON(json, ''); + + const nodeProcessor = getNewDefaultNodeProcessor(); + const result = await nodeProcessor.process(indexPath, index); + + const expected = [ + '

Index

', + // eslint-disable-next-line max-len + '

existing segment

', + ].join('\n'); + + expect(result).toEqual(expected); +}); From 9be398d91bd22c3b86409accd82ddd935ec55876 Mon Sep 17 00:00:00 2001 From: Chan Yu Cheng Date: Wed, 15 Mar 2023 16:41:08 +0800 Subject: [PATCH 7/9] Update test cases --- .../functional/test_site/expected/index.html | 37 +++++++++++-------- .../expected/index.page-vue-render.js | 11 ++++-- .../testBaseUrlInIncludeSrc._include_.html | 8 ++-- .../test_site/expected/siteData.json | 2 +- .../expected/testIncludeMultipleModals.html | 8 ++-- ...stIncludeMultipleModals.page-vue-render.js | 2 +- 6 files changed, 41 insertions(+), 27 deletions(-) diff --git a/packages/cli/test/functional/test_site/expected/index.html b/packages/cli/test/functional/test_site/expected/index.html index c579c47a41..95e1abb0b7 100644 --- a/packages/cli/test/functional/test_site/expected/index.html +++ b/packages/cli/test/functional/test_site/expected/index.html @@ -370,9 +370,11 @@

Focus groups resolved or clarified as necessary.

Include segment

-
Requirements gathering, requirements elicitation, requirements analysis, - requirements capture are some of the terms commonly and interchangeably used to represent the activity - of understanding what a software product should do.
+
+

Requirements gathering, requirements elicitation, requirements analysis, + requirements capture are some of the terms commonly and interchangeably used to represent the activity + of understanding what a software product should do.

+

Boilerplate include