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(prettify) #398

Merged
merged 6 commits into from
Jun 20, 2017
Merged

feat(prettify) #398

merged 6 commits into from
Jun 20, 2017

Conversation

neoFelhz
Copy link
Collaborator

Contributing rules

  • Fork the repo and create your branch from canary. Then be sure to put the canary branch as the target for your pull request.
  • Please be sure to follow the contributing guidelines, especially for commit message
  • Remove the Contributing rules part from this description
  • Fill out the other parts from this description

If you don't do so, we might change your pull request's title and using squash to merge your changed.

What kind of change does this PR introduce? (check one with "x")

  • Bug fix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

Description

  • remove the custom_css
  • add public cdn support
  • only load prettify at post pages
  • upload theme css without comment
  • load prettify.js only at post
  • remove custom_css
  • import prettify css

Verification steps

No verification steps.

- Remove the custom_css
- Add public cdn support
- Only load prettify at post pages
- load prettify.js only at post
- import prettify_css
- remove custom_css
@neoFelhz neoFelhz requested review from cubesky and iblh June 17, 2017 04:17
@xiongxianzhu
Copy link
Contributor

xiongxianzhu commented Jun 17, 2017

In the branch feat/code_highlight, the following files need to be changed.

  • source/css/prettify.css
  • source/css/prettify.min.css
  • source/css/prettify/*.min.css
  • layout/_partial/head.ejs

as follows:

source/css/prettify.css:

In order to properly apply the various theme styles of prettify without being affected by other css styles, the file source/css/prettify.css should be changed as follows:

@charset "UTF-8";

/* for color-themes-for-google-code-prettify */
pre{
    white-space: pre-wrap;
    word-break: break-all;
    word-wrap: break-word;
}

#post-content .prettyprint{
    padding: 1.2em;
    border-radius: 0;
}

#post-content ol,#post-content ul{
    padding-left: 51px;
    font-size: 1rem;
    margin: 0;
}

#post-content .prettyprint li.L0, #post-content .prettyprint li.L1,
#post-content .prettyprint li.L2, #post-content .prettyprint li.L3,
#post-content .prettyprint li.L4, #post-content .prettyprint li.L5,
#post-content .prettyprint li.L6, #post-content .prettyprint li.L7,
#post-content .prettyprint li.L8, #post-content .prettyprint li.L9 {
    padding-left: 0.8em;
}

and then compress prettify.css into prettify.min.css.

source/css/prettify/*.min.css

In order to properly apply the various theme styles of prettify without being affected by other css styles, the files source/css/prettify/*.min.css should be changed.
So, at the beginning of the source/css/prettify/*.min.css file, replace .prettyprint {background: #xxxxxx; ... with .prettyprint {background: #xxxxxx!important; ...

layout/_partial/head.ejs

At line 138 of the file head.js, replace

<%- cssLsload({path:(theme.vendors.materialcdn + '/css/' + theme.prettify.theme + '.min.css'),key:'prettify_theme'}) %>

with

<%- cssLsload({path:(theme.vendors.materialcdn + '/css/prettify/' + theme.prettify.theme + '.min.css'),key:'prettify_theme'}) %>

At line 149 of the file head.js, replace

<%- cssLsload({path:(config.root + 'css/' + theme.prettify.theme + '.min.css'),key:'prettify_theme'}) %>

with

<%- cssLsload({path:(config.root + 'css/prettify/' + theme.prettify.theme + '.min.css'),key:'prettify_theme'}) %>

and at line 6 of the file, the following should be removed

<% if(theme.materialcdn.use === true) { %>
    <link rel="dns-prefetch" href="<%= theme.materialcdn.base %>"/>
<%}%>

@neoFelhz
Copy link
Collaborator Author

neoFelhz commented Jun 17, 2017

@xiongxianzhu OK, got it.
dns-prefetch of materialcdn has already fixed in canary branch.

- fix prettify being affected by other styles
- fix background in prettify theme
- fix prettify theme import
@neoFelhz neoFelhz merged commit ed3502d into canary Jun 20, 2017
@neoFelhz neoFelhz deleted the feat/code_highlight branch June 20, 2017 08:33
@neoFelhz neoFelhz mentioned this pull request Jun 21, 2017
9 tasks
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.

None yet

3 participants