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): line highlighting not working correctly when importing code snippets #2441

Merged
merged 2 commits into from Jun 30, 2020

Conversation

diogotcorreia
Copy link
Contributor

Summary

When importing code snippets with the <<< syntax, you could only either specify a single range ({34-37}) or a maximum of two lines to be highlighted ({3,6}).

This PR fixes the regex that was matching the syntax so it allows for unlimited line highlights like the ``` syntax.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

Before this PR, a snippet like

<<< @/path/to/file.js{5-7,10-16,25}

would output Invalid code snippet option.

Old regex:
image

New regex:
image

for importing files (using `<<<`)
@diogotcorreia diogotcorreia changed the title Fix line highlighting not working correctly Fix: line highlighting not working correctly Jun 11, 2020
@StevenLikeWatermelon
Copy link

good job! it helped me a lot

Copy link
Collaborator

@billyyyyy3320 billyyyyy3320 left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Could you add a unit test for this change? (markdown/__tests__/snippet.spec.js)

@billyyyyy3320 billyyyyy3320 changed the title Fix: line highlighting not working correctly fix($markdown): line highlighting not working correctly when importing code snippets Jun 28, 2020
Signed-off-by: Diogo Correia <me@diogotc.com>
@diogotcorreia
Copy link
Contributor Author

@billyyyyy3320 Done! 👍

Copy link
Collaborator

@billyyyyy3320 billyyyyy3320 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

None yet

4 participants