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

fix(markdown): refine regex to handle newlines after indentation groups #6917

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

KenLSM
Copy link
Contributor

@KenLSM KenLSM commented Nov 21, 2023

Problem

Given

title 1
- item 1
- item 2

title 2

Title 2 will be rendered under the same indentation as item 2 as it did not break out of the <li> group.

title 1
- item 1
- item 2

  title 2

Replacing \n with an empty space prevents markdown from detecting \n\n that signifies a break from the list item.

Solution

Refining replacement of \n to exclude cases that are trying to break out of indentation groups.

There were two solutions considered.

  1. Provide options of having true markdown syntax for admins
  2. Better qualification of regex

We've chosen to go with 2 as this qualification is not adding additional edgecase on top of what we already have. Providing true markdown will require additional learning curve for the admins.

@KenLSM KenLSM changed the title fix: refine regex to handle newlines after indentation groups fix(markdown): refine regex to handle newlines after indentation groups Nov 21, 2023
Copy link
Contributor

@tshuli tshuli left a comment

Choose a reason for hiding this comment

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

lgtm!

@KenLSM KenLSM enabled auto-merge (squash) November 21, 2023 07:11
@KenLSM KenLSM merged commit 076c1cf into develop Nov 21, 2023
32 of 35 checks passed
@KenLSM KenLSM deleted the fix/para-markdown-indent branch November 21, 2023 07:39
@KenLSM KenLSM mentioned this pull request Nov 21, 2023
9 tasks
KenLSM added a commit that referenced this pull request Nov 21, 2023
* feat: charts (#6790)

* chore: import react google charts

* feat: create skeleton insights page

* fix: regex for route matching for insight page

* fix: layout of insights page

* feat: dummy endpoint for all encrypted data

* feat: queries to get all encrypted submission

* fix: encrypted model find params

* feat: get and decrypted all submission data

* feat: get formfields

* feat: generate charts

* fix: typing of spacing

* feat: create mapping for field to charts

* feat: some upgrades to format charts

* feat:wordcloud

* fix: remove excess divider

* fix: prefill rating values in bar chart

* feat: add question number to chart title

* feat: skeleton for changing chart to table

* chore: add gstatic charts to csp policy

* fix: rating average counting

* feat: table toggle mode

* feat: use icon button instead of toggle

* feat: dummy date picker

* fix: better date range picker styling

* feat: date range filtering

* fix: do not show rating if no values

* fix: filtering by date and styling

* fix: increase size of charts

* fix: do not display wordcloud if no words

* fix: alignment of wordcloud title

* fix: typing for submission insights dto

* refactor: make code more readable

* fix: typing of render array

* fix: do not randomize color for rating

* feat: fix bar graph colours changing on refocus

* feat: fix random word cloud movements on re-render

* feat: address MR comments

* feat: corrected types and fixed lint comments

* feat: update average rating to account for division by 0

* feat: refactored filter function to remove redundant date parsing

* feat: set max words for word cloud

* fix: fe lint issue

* refactor: cleanup constants

* feat: add growthbook toggle

* fix: flickering pie chart tooltip

* fix: ordering of frontend/package.json

* chore: add utils

* feat: add empty insights field

* fix: typeerror on admin submission

* refactor: rename insights to charts

* feat: add beta badge

* refactor: secretkeyverification to common component for results and charts tab

* fix: table charts ui

* fix: charts secretkeyvewrification component

* fix: remove stray space between charts and badge on tab title

* fix: remove testing flag

* chore: update copy for no charts generted

* fix: endday not calculated correctly

* feat(be): add limit and reverse chrono sort for submissions query

* feat(fe): add forced redirect for email charts

* chore: update charts supported field for better visual alignment with secret key section

* feat: add marketing prompts for charts

* chore: add copy for 1000 chart limit

* chore: shorten copy

* refactor: create daterangepicker helpers

* refactor: use helpers from daterangepicker

* feat: add no charts prompt

* chore: update language to omit implication of uncertainty

* fix: number typo

* feat: correctly retrieve based on date range

* fix: remove incorrect generic

* fix: remove unnecessary comment

---------

Co-authored-by: Timothee Groleau <timothee.groleau@gmail.com>
Co-authored-by: sebastianwzq <sebastian@open.gov.sg>
Co-authored-by: Ken <ken@open.gov.sg>
Co-authored-by: tshuli <shuli@open.gov.sg>

* fix: omit isVisible property from webhook response (#6907)

fix: omit isVisible property

* fix(markdown): refine regex to handle newlines after indentation groups (#6917)

fix: refine regex to handle newlines after indentation groups

* chore: bump version to v6.91.0

---------

Co-authored-by: Foo Chi Fa <59867455+foochifa@users.noreply.github.com>
Co-authored-by: Timothee Groleau <timothee.groleau@gmail.com>
Co-authored-by: sebastianwzq <sebastian@open.gov.sg>
Co-authored-by: tshuli <shuli@open.gov.sg>
Co-authored-by: wanlingt <56983748+wanlingt@users.noreply.github.com>
sebastianwzq added a commit that referenced this pull request Nov 23, 2023
@KenLSM KenLSM mentioned this pull request Nov 28, 2023
26 tasks
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.

2 participants