-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Issue #16300: Static html for syntax highlight in web site #16334
base: master
Are you sure you want to change the base?
Conversation
github, generate site |
@@ -143,7 +143,6 @@ th { | |||
.prettyprint { | |||
padding: 0.5em !important; | |||
overflow: auto; | |||
white-space: nowrap; |
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.
why this was removed? 👀
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.
This is already taken care through skin, if not removed it was giving all code in single line with horizontal scroll
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.
default was pre-wrap? I'm referring to:
modified css, skin automatically applies this by converting nowrap->pre-wrap
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.
default was nowrap, but this was overriding skins inbuilt css and giving all code in a single line, when removed it got fixed and skins pre-wrap was applied instead
GitHub, generate website |
<script type="text/javascript" | ||
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | ||
<script type="text/javascript" src="$relativePath/js/anchors.js"></script> | ||
<script type="text/javascript" src="$relativePath/js/google-analytics.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/1.0.0/prettify.min.js"></script> | ||
<script type="text/javascript" | ||
src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script> | ||
<link rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/gh/google/code-prettify@master/styles/prettify.css" type="text/css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prettify/1.0.0/prettify.min.css"> |
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.
we removed the external JS library and syntax highlighting is still working. In this comment, you said we just needed to use following in our site.xml
:
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>2.0.1</version>
</skin>
And we needed to add prettyprint
class to the <pre>
tag. You added it in your previous PR:
Apache also does something similar:
this if condition adds the prettyprint
class to their code snippets so their code snippets also gets highlighted, on top of it, they also adds linenums
class with prettyprint
so they also get line numbers in their snippets:
Am I going in right direction? If I'm correct then I think we didn't needed to add external JS library, we only needed to add prettyprint
class to the <pre>
tag.
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.
this if condition adds the prettyprint class to their code snippets so their code snippets also gets highlighted, on top of it, they also adds linenums class with prettyprint so they also get line numbers in their snippets:
Yes, exactly, we don't need any external js library just prettyprint class and pre tags
Issue: #16300
Output: