Page MenuHomePhabricator

Add the match and parse functions for spoiler text
AbandonedPublic

Authored by rohan on Oct 11 2022, 11:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 2:57 PM
Unknown Object (File)
Sun, Oct 27, 2:57 PM
Unknown Object (File)
Sun, Oct 27, 2:49 PM
Unknown Object (File)
Sep 27 2024, 8:49 PM
Unknown Object (File)
Sep 18 2024, 10:33 PM
Unknown Object (File)
Sep 7 2024, 4:37 AM
Unknown Object (File)
Sep 7 2024, 4:37 AM
Unknown Object (File)
Sep 7 2024, 4:34 AM
Subscribers

Details

Summary

Added the match and parse functions in order to execute the RegEx in the previous diff (in the stack), so we can then capture the spoiler text and transform it later.

Linear Issue: https://linear.app/comm/issue/ENG-1982/set-up-the-match-and-parse-functions-in-markdownjs-in-the-lib

Depends on D5335

Test Plan

The testing for this will come in the subsequent diff, where we
will add the spoiler rule to the markdown rules in native.

Diff Detail

Repository
rCOMM Comm
Branch
spoiler_2_match_and_parse
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

looks good to me! Everything makes sense and seems to follow what was in the simple-markdown docs

ashoat requested changes to this revision.Oct 11 2022, 7:31 PM
ashoat added a reviewer: kamil.
ashoat added a subscriber: kamil.

Adding @kamil, who has looked at match/parse functions in SimpleMarkdown recently. Some questions inline

lib/shared/markdown.js
255

We seem to use SimpleMarkdown.inlineRegex(spoilerRegex) for this elsewhere in the codebase

264–273

Noticed a function SimpleMarkdown.parseInline that seems to match inlineRegex and we use somewhere else in the codebase. I'm wondering whether or not we should just use that. Can you explain what properties differentiate that function from the approach you've taken here, eg. does setting state.inline affect how nested Markdown might be processed?

This revision now requires changes to proceed.Oct 11 2022, 7:32 PM

Discussed in my sync with @ashoat - there's no need for custom match and parse methods, we can instead use the ones from SimpleMarkdown, and I will update the subsequent diff with the new spoiler rule