Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve line breaks in markdown #1241

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

nknguyenhc
Copy link
Contributor

Summary:

Fixes #1230

Changes Made:

  • Allow preserving line breaks. This is done by changing the breaks option in the app module markdown declaration.

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
Copy link

codecov-commenter commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@luminousleek luminousleek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! For reference, here's what the sample text looks like without this PR

Screenshot 2024-02-07 at 10 06 53 AM

Just a minor thing: the PR title is a bit confusing - I think changing it to your commit title would be better.

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

@nknguyenhc nknguyenhc changed the title Add parsing of subsets Preserve line breaks in markdown Feb 7, 2024
@nknguyenhc
Copy link
Contributor Author

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.

@nknguyenhc nknguyenhc merged commit a9d38dd into CATcher-org:master Feb 12, 2024
5 checks passed
vigneshsankariyer1234567890 added a commit that referenced this pull request Mar 4, 2024
* Fix broken duplicate link (#1233)

Fix the broken link of a duplicate issue

Currently, the user cannot open the link to a duplicate issue
when opening an issue, as described in #1228.

The links now work as expected.

* Add whitespace validation (#1237)

* Add whitespace validation

* Update whitespace validation for new issue

* Update whitespace validation for title of new issues

* Update whitespace validation for title of new issues

* Move validators into core

* Update import order

---------

Co-authored-by: Misra Aditya <e1096355@u.nus.edu>

* Fix uncaught errors when attempting to access an invalid route

There is an uncaught error when the users click on an invalid internal link in Markdown or enter an invalid link in browser.

Internal links are unlikely to be used for bug reporting and are more likely to be invalid.

Let's show an error toaster and stop the navigation when clicking on an internal link in Markdown. Also, redirect the users to the login page if the users enter invalid link in browser.

* Set default branch to `main`

Previously, image uploads depend on the user's default branch.
Now, we set the branch for image upload to be `main`. Images will 
be uploaded to `main` as a result.

---------

Co-authored-by: Chee Hong <c.h.wong2606@gmail.com>

* Preserve linebreaks (#1241)

With preserving linebreaks, subset list items are rendered as a list,
and paragraph rendering is the same as Github.

* Faulty list view when back navigating (#1243)

Issue table settings such as page index are not 
saved when table is re-mounted.

This behavior inconveniences users as their settings 
are reset everytime they navigate to a specific issue and back.

Let's lift up the table settings of each mounted table to 
a service which the tables pull from when mounted.

* Upgrade to Angular 12 (#1242)

Some of our packages are old and outdated. We should actively maintain 
and keep these packages up-to-date so it is easier to maintain in the 
future.

Let's upgrade to Angular 12 to keep our packages up-to-date.

* Fix markdown blockquote preview difference (#1245)

Due to DOMPurify, the content used for preview is different.
However, given that ngx-markdown already has sufficient sanitation
by default, we remove sanitation by DOMPurify.

* Create release for v3.5.3

---------

Co-authored-by: Nguyen <87511888+nknguyenhc@users.noreply.github.com>
Co-authored-by: AdityaMisra <114080910+MadLamprey@users.noreply.github.com>
Co-authored-by: Misra Aditya <e1096355@u.nus.edu>
Co-authored-by: NereusWB922 <107099783+NereusWB922@users.noreply.github.com>
Co-authored-by: Chee Hong <c.h.wong2606@gmail.com>
Co-authored-by: Arif Khalid <88131400+Arif-Khalid@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parsing of subset list elements in the text box
3 participants