Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Markdown Syntax Highlights #2332

Merged
merged 13 commits into from
Jul 26, 2018
Merged

Conversation

CrossR
Copy link
Member

@CrossR CrossR commented Jun 19, 2018

Second set of Markdown changes that fixes #1653 and adds Syntax highlights to code blocks.

image

Things to check:

  • - Performance as highlight js is synchronous. Maarked does have an option for async, but I didn't really find much documentation on it, nor any well maintained async libraries compared to highlightjs.
  • - Add some testing for both this, and my previous PR.
    • Check syntax is loaded, check applied to elements, check not applied when relevant language is given, check swapping back and forth from md buffers to close etc.
    • Not sure if its worth adding this in a separate PR to get this merged quicker and with further testing?
  • - Currently on the syntax highlights, should it change the code block background colour too?

Something I realised from my previous PR is that when opening a browser link, the markdown preview remains open for some reason, though swapping to any other non-markdown buffer works fine. It looks like the leave command is called once to close, but the enter is called multiple times after and re-opens the markdown preview as the buffer is still a markdown file.

I could update the onBufferEnter command to close the preview too, but haven't tested that yet.

Similarly, opening a MD file directly doesn't spawn the preview, but opening one once Oni is open works fine.

@codecov
Copy link

codecov bot commented Jun 20, 2018

Codecov Report

Merging #2332 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2332   +/-   ##
=======================================
  Coverage   43.36%   43.36%           
=======================================
  Files         341      341           
  Lines       13431    13431           
  Branches     1768     1768           
=======================================
  Hits         5824     5824           
  Misses       7331     7331           
  Partials      276      276
Impacted Files Coverage Δ
...src/Services/Configuration/DefaultConfiguration.ts 87.5% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c465082...a3baa76. Read the comment docs.

@CrossR
Copy link
Member Author

CrossR commented Jun 20, 2018

Pushing up some tests for this and the previous PR now.

I think the background colour can stay as is for now, it makes sense to use the Oni defined colours to match the theme its rendered in.
Still not sure about the async vs sync plugins though.

@CrossR
Copy link
Member Author

CrossR commented Jun 21, 2018

Also looks like we've got CodeCov to only look at the main repo, so despite most of the PR being updated tests, the coverage has dropped.

@@ -290,10 +290,6 @@ export const activate = (
detail: "",
enabled: isBrowserScrollCommandEnabled,
})

ipcRenderer.on("open-oni-browser", (event: string, args: string) => {
openUrl(args)
Copy link
Member Author

Choose a reason for hiding this comment

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

Left over from previous PR, tidied up in this one.

@CrossR CrossR changed the title [WIP] Markdown Syntax Highlights Markdown Syntax Highlights Jun 30, 2018
@CrossR
Copy link
Member Author

CrossR commented Jun 30, 2018

I've added a config option for this now, incase it is needed.

I'm still not too sure what to do about the sync vs async nature, but I think the only way I'll really be able to tell is if more people start using it and give some feedback.

I've defaulted this to on, since having an experimental feature in an experimental feature seemed like too many gates to jump through.

@CrossR CrossR requested a review from TalAmuyal June 30, 2018 14:18
TalAmuyal
TalAmuyal previously approved these changes Jun 30, 2018
Copy link
Collaborator

@TalAmuyal TalAmuyal left a comment

Choose a reason for hiding this comment

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

Looks fantastic!

@CrossR
Copy link
Member Author

CrossR commented Jun 30, 2018

Could I get somebody to restart my AppVeyor build/merge this?

@akinsho
Copy link
Member

akinsho commented Jul 11, 2018

@CrossR seems our AppVeyor links or mine at least now leads me to a project not found or no access but if I sign in manually I get access to the oni project but then finding the related build is very manual checking through all the previous builds so not sure how to reset this tbh except manually searching which I can try later

@CrossR
Copy link
Member Author

CrossR commented Jul 11, 2018

Yep since we moved, the build is still pointing to the old one. I'll push a change over the weekend and that should fix it.

@bryphe
Copy link
Member

bryphe commented Jul 26, 2018

Just tried out! Functionality looks great:

image

And the code change looks good to me 👍 Impressive test coverage!

@CrossR CrossR merged commit b901ecd into onivim:master Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Images not shown in Markdown preview
4 participants