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 PGML Emphasis in the PG CodeMirror editor. #2636

Merged

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Nov 23, 2024

Really, the fix has been published in an updated pg-codemirror-editor package (actually the bug was in the codemirror-lang-pg package). This just updates the version in the package.json file.

This was observed by @somiaj in #2595 (see #2595 (comment)). It turns out the problem was an error in converting from the Perl substr method to the JavaScript substring method. The code actually uses the JavaScript slice method now.

@drgrice1 drgrice1 force-pushed the pg-codemirror-emphasis-fix branch 2 times, most recently from 408d942 to 2a83fe8 Compare November 23, 2024 12:08
@somiaj
Copy link
Contributor

somiaj commented Nov 23, 2024

This fixes the issue, thanks. I also notice that if using double ** or __ for strong/emphasis, that there is a bit of issue with the matching/formatting.

image

Also seems PGML doesn't require balance here, and will match any number of * or _ on both ends, so this works but the syntax highlighting should probably also match all characters not just the first.

image

@drgrice1
Copy link
Member Author

I can fix that. Note that PGML allows it, but it isn't documented that it should work. Why would you do that anyway?

@drgrice1 drgrice1 force-pushed the pg-codemirror-emphasis-fix branch from 2a83fe8 to 88ef750 Compare November 23, 2024 17:14
@drgrice1
Copy link
Member Author

I have fixed the emphasis delimiter length (for those who unintelligibly want to type extra characters).

@somiaj
Copy link
Contributor

somiaj commented Nov 23, 2024

I am just in the habit of using two delimiters from other markdown implementations and PGML has always accepted it, so that is what I noticed initially. I just decided to see what PGML would do if I didn't have matching numbers, and it seemed to not care. I guess I never noticed the using of two delimiters wasn't documented. So I would never use unmatching delimiters, but often use two.

@drgrice1 drgrice1 force-pushed the pg-codemirror-emphasis-fix branch from 88ef750 to 7650d5d Compare November 23, 2024 17:58
@drgrice1 drgrice1 changed the title Fix PGML Emphasis. Fix PGML Emphasis in the PG CodeMirror editor. Nov 23, 2024
Really, the fix has been published in an update pg-codemirror-editor
package (actually the bug was in the codemirror-lang-pg package).  This
just updates the version in the package.json file.
@drgrice1 drgrice1 force-pushed the pg-codemirror-emphasis-fix branch from 7650d5d to 5130c29 Compare November 24, 2024 03:21
@Alex-Jordan Alex-Jordan merged commit ceca849 into openwebwork:develop Nov 24, 2024
2 checks passed
@drgrice1 drgrice1 deleted the pg-codemirror-emphasis-fix branch November 24, 2024 03:33
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.

3 participants