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
Pretty print #288
Pretty print #288
Conversation
This is useful if a custom stylesheet already has the highlighting definitions integrated.
The latest versions are now AMD compatible, as long as the module name `google-code-prettify` is used. Updated Highlight.js to use the exported object.
Please make sure you also prepare documentation for this new feature: |
["text!core/css/highlight.css"], | ||
function (css) { | ||
["text!core/css/highlight.css", "google-code-prettify"], | ||
function (css, PR) { |
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.
what is PR in this context? Might be better to use a name that is more clear for this argument?
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.
That is just the normal global name exported by recent versions of google-code-prettify. Following the example of jquery imports using $
, i stuck with the name of the global. This makes it consistent with the language extentions like the lang-css.js
that I mentioned.
I agree that it is hardly the most descriptive name, but then again neither is $
or _
.
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.
Thanks for the clarification.
I agree that it is hardly the most descriptive name, but then again neither is $ or _.
Agree, but that's not an excuse to make our code illegible :)
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.
If you don't mind @marcoscaceres, I'll be the judge of that. PR is a perfectly fine name to use here for all the reasons @KevinCathcart mentioned.
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.
Of course I don't mind @darobin. I was just asking what it was and where it came from - it was not immediately clear to me, which is why I asked for the clarification (which also made sense). My comments about $ and _ being bad was unrelated to the clarification - sorry if that was not clear.
Thanks @KevinCathcart. Re |
This pull request simply adds a
noHighlightCSS
config option to leave out the code highlighting style sheet (useful if using a custom style-sheet to avoid needing higher specificity to override the defaults).I also split out the google-code-prettify code from the
highlight.js
file, and update it to the latest version.The latest version now registers as an AMD module (in the same way as jquery), so utilize that fact rather than relying on the globals.
Unfortunately, because it self-registers like jquery, it must be referenced with the name
google-code-prettify
, which dictates the file name and location unless the require.jspaths
feature is used.I'd also like to add the
lang-css.js
auxillary file to allow for highlighting CSS fragments. However, I'm not entirely sure where to put that. Should it go injs/core/
, injs/
, or somewhere else?