-
Notifications
You must be signed in to change notification settings - Fork 491
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
Allow to add Code Snippets With Syntax Highlighting support (without need for extension) #658
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code-wise, this looks fine. However, I think it would be good to get a better visual indicator in the editor when you have inserted some code. At the moment you may not know you've already inserted code using this new approach and end up doing it again. Even if it's something as simple as a dotted box around the code segment, something like that.
Is the visual indicator all that's keeping this from merging with the master and being available? |
What stops this to be merged? |
private const string DEFAULT_SKIN = CodeHighlighterSkins.Sunburst; | ||
|
||
private static readonly string _prettifyScript = | ||
$"<script src=\"https://cdn.rawgit.com/google/code-prettify/master/loader/{PRETTIFY_SCRIPT_NAME}?skin={DEFAULT_SKIN}\"></script>"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://rawgit.com/ is currently in sunset and will be shut-down by October. Whatever service is used instead, the user should be informed that a third-party script is being inserted into their site, and a third-party service is used to fetch it. Use of subresource integrity would also be desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this site that produces HTML for pretty printing code, and it has an API you can call:
I've not yet worked out what this PR is actually doing, so I haven't any ideas on how to use it to update this PR, but thought I'd mention it in case some one else can use it to update this PR, or else explain what this code is doing so that I can attempt to update it.
I hope this won't break screen reader support in the new editor. Perhaps we can integrate some automated accessibility checks to be reviewed by a human later? 2 possible choices are below.
|
I've just downloaded the archive for the Precode plugin for Windows Live Writer, though it is also a WPF app. Do you think there's any mileage in looking at the source code for it and seeing if it could be easily ported to OLW? |
Added support for adding Code Snippets as a first class feature.
Users will be able to write code (or paste coed) on the editor, and mark it as 'Code' just like they can mark a URL as 'Hyperlink'. As a result, the code should be rendered with syntax highlighting.