CATcher-org / CATcher

CATcher is a software application used for peer-testing of software projects.
https://catcher-org.github.io/CATcher/
MIT License
71 stars 66 forks source link

Preserve line breaks in markdown #1241

Closed nknguyenhc closed 4 months ago

nknguyenhc commented 4 months ago

Summary:

Fixes #1230

Changes Made:

Note that in #1230, the subset list is not exactly rendered as a list, but is rendered with linebreaks.

image

Github preserves linebreaks when rendering markdown, hence it looks like the items are rendered as list items.

One consequence of this PR is that, whenever two sentences are separated only by one line break, in html, instead of the two being one paragraph (as expected from standard markdown syntax), the two are preserved and rendered as two paragraphs (as expected behaviour of github markdown).

Summarising everything in one example, the following markdown code:

1. Item 1
  A. Sub item 1
  B. Sub item 2

| Header 1 | Header 2 |
|---|---|
| Cell 1 | Content 2 |

* Name
* Space

Line 1.
Line 2.

Paragraph 1.

Paragraph 2.

is rendered as:

image

Proposed Commit Message:

Preserve line breaks

With preserving linebreaks, subset list items are rendered as a list,
and paragraph rendering is the same as Github.
codecov-commenter commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2c18b71) 53.41% compared to head (3c4af54) 53.44%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1241 +/- ## ========================================== + Coverage 53.41% 53.44% +0.03% ========================================== Files 103 103 Lines 2928 2928 Branches 544 544 ========================================== + Hits 1564 1565 +1 Misses 1014 1014 + Partials 350 349 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nknguyenhc commented 4 months ago

Also, I think you can explore upgrading our ngx-markdown version to enable gfmd as you mentioned in #1230

Actually I realised that ngx-markdown documentation was actually outdated/incorrect. Also, GFMD was already enabled in CATcher, so right now the current ngx-markdown version is sufficient. We probably can explore upgrading ngx-markdown version when we upgrade the packages/angular/node version.