Skip to content

fix(markdown-mode): prevent block change from stripping numbers#140

Merged
dancormier merged 4 commits intomainfrom
dcormier/fix-md-line-w-num-toggle-69
Jun 16, 2022
Merged

fix(markdown-mode): prevent block change from stripping numbers#140
dancormier merged 4 commits intomainfrom
dcormier/fix-md-line-w-num-toggle-69

Conversation

@dancormier
Copy link
Contributor

@dancormier dancormier commented Jun 14, 2022

fixes #69

Describe your changes

This PR prevents markdown mode commands from stripping numbers from the beginning of strings when changing the block type. It achieves this by checking first for ordered list block types then for any non-alphanumeric leading characters.

PR Checklist

  • All new/changed functionality includes unit and (optionally) e2e tests as appropriate
  • All new/changed functions have /** ... */ docs
  • I've added the bug/enhancement and other labels as appropriate

Environment(s) tested

  • Device: desktop
  • OS: Mac OS
  • Browser: Firefox 101.0

Additional context

The regexes in matchLeadingBlockCharacters could for sure use some work. This PR targets the specific issue mentioned in #69 but could be refactored to check leading characters per the markdown spec.

@dancormier dancormier added bug Something isn't working mode - markdown Affects the editor's markdown input mode labels Jun 14, 2022
@dancormier dancormier requested a review from b-kelly June 14, 2022 17:20
@netlify
Copy link

netlify bot commented Jun 14, 2022

Deploy Preview for nifty-lalande-39c157 ready!

Name Link
🔨 Latest commit cf54de7
🔍 Latest deploy log https://app.netlify.com/sites/nifty-lalande-39c157/deploys/62ab5748fd959800083a77f5
😎 Deploy Preview https://deploy-preview-140--nifty-lalande-39c157.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dancormier dancormier marked this pull request as ready for review June 14, 2022 17:31
Copy link
Contributor

@b-kelly b-kelly left a comment

Choose a reason for hiding this comment

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

lgtm. Added support for 12) as well, since ) is also a valid ordered list marker (see the spec). I also added the @internal TSDoc tag as well, which I only recently realized was a thing.

@dancormier
Copy link
Contributor Author

Added support for 12) as well, since ) is also a valid ordered list marker (see the spec).

In the course of building this, I realized that we should support ) and neglected to pop a TODO in. Thanks for catching this!

It's 🦐-in' time!

@dancormier dancormier merged commit 32385e2 into main Jun 16, 2022
@dancormier dancormier deleted the dcormier/fix-md-line-w-num-toggle-69 branch June 16, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mode - markdown Affects the editor's markdown input mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown bullet list command strips numbers from the start of lines

2 participants