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

feat: add support to line numbers in markdown #217

Merged
merged 6 commits into from
May 29, 2019

Conversation

lubien
Copy link
Contributor

@lubien lubien commented May 29, 2019

  • highlight-plugin.js now read global and local { lineNumber: true}.
  • Added tests and snapshots for the feature.
  • Receive and validate lineNumber from markdown settings.
  • Add some CSS for the line numbers.
  • Document both the markdown config and the inline option.

Summary

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/CSS related code, please provide the before/after screenshot:

Before
image

After
image

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:

Tried to keep CSS at minimum to maintain the feel of the current styles.

Had to change renderPreWrapper (packages/saber/lib/markdown/highlight-plugin.js) signature since xo limits arguments to 4.

Took minor edits over highlightLines (packages/saber/lib/markdown/highlight-plugin.js) since the current implementation assumed it was the only option.

Hopefully my edits on the docs are to your liking.

* highlight-plugin.js now read global and local { lineNumber: true}.
* Added tests and snapshots for the feature.
* Receive and validate lineNumber from markdown settings.
* Add some CSS for the line numbers.
* Document both the markdown config and the inline option.
@netlify
Copy link

netlify bot commented May 29, 2019

Deploy preview for saber ready!

Built with commit 77bebf5

https://deploy-preview-217--saber.netlify.com

@egoist
Copy link
Collaborator

egoist commented May 29, 2019

Made a small change to make line numbers fixed and support line highlighting.

屏幕快照 2019-05-29 下午6 35 44

@lubien
Copy link
Contributor Author

lubien commented May 29, 2019

Looks great to me :)

@egoist egoist changed the title Fix #178: Add support to line numbers in markdown feat: add support to line numbers in markdown May 29, 2019
@egoist egoist merged commit 1561c61 into saberland:master May 29, 2019
@lubien
Copy link
Contributor Author

lubien commented May 29, 2019

besto seiba

@lubien lubien deleted the markdown-line-numbers branch May 29, 2019 11:45
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