Skip to content

Commit

Permalink
merge(#494): merge feat/hanabi into canary
Browse files Browse the repository at this point in the history
fix(#495)/feat(hanabi): add hanabi code pretty
  • Loading branch information
neoFelhz authored Aug 22, 2017
2 parents bebbb06 + 11eb5c4 commit fd20a16
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
31 changes: 24 additions & 7 deletions _config.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,34 @@ qrcode:
enable: false
use: plugin

# Code
# Available value: true | false
# theme value:
# theme-name # /vendors/prettify/themes/[theme-name].css
# if true, check highlight option in _config.yml. Make sure that default code highlight plugin is disabled.
# highlight:
# enable: false
# Code highlight
# Available value for `prettify` or `hanabi`: true | false
# You can only enable one of them to avoid issues. Also you need to check highlight option in _config.yml. Make sure that default hexo built in highlight plugin is disabled.
# highlight:
# enable: false
#
# Prettify
# theme value:
# theme-name # /vendors/prettify/themes/[theme-name].css
prettify:
enable: false
theme: "vibrant-ink" # default value: "vibrant-ink" # theme-name without '.css'

# Hanabi
# hanabi © egoist, Released under the MIT License
# https://github.com/egoist/hanabi
#
# line_number: [true/false] # Show line number for code block
# includeDefaultColors: [true/false] # Use default hanabi colors
# customColors: # This value accept a string or am array to setting for hanabi colors.
# # If `includeDefaultColors` is true, this will append colors to the color pool
# # If `includeDefaultColors` is false, this will instead default color pool
hanabi:
enable: false
line_number: true
includeDefaultColors: true
customColors:

# Post License
# You can specify the text you want to show in the end of your posts and pages, HTML tag is supported.
# For example, you can setup a CC license as:
Expand Down
18 changes: 18 additions & 0 deletions layout/_partial/import_js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
<% } %>
<% } %>
<% } %>
<% if (theme.hanabi.enable) { %>
<%- jsLsload({path:('js/hanabi-browser-bundle.js'),key:'hanabi_browser_bundle'}) %>
<% } %>

<!-- Window Load -->
<!-- add class for prettify -->
Expand All @@ -87,6 +90,21 @@
})
<% } %>
<% } %>
<% if (theme.hanabi.enable) { %>
<% if (!theme.hanabi.includeDefaultColors) { %>
HanabiBrowser.clearColors();
<% } %>
<% if (theme.hanabi.customColors) { %>
<% if (typeof theme.hanabi.customColors === 'string') { %>
HanabiBrowser.putColor('<%= theme.hanabi.customColors %>');
<% } else { %>
<% theme.hanabi.customColors.forEach(function(elements) { %>
HanabiBrowser.putColor('<%= elements %>');
<% }); %>
<% } %>
<% } %>
HanabiBrowser.start('pre code',<%= theme.hanabi.line_number %>);
<% } %>
</script>

<!-- MathJax Load-->
Expand Down
2 changes: 1 addition & 1 deletion layout/_widget/dnsprefetch.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% if(theme.vendors.materialcdn) { %>
<link rel="dns-prefetch" href="<%= theme.vendors.materialcdn %>"/>
<% } %>
<% if(theme.leancloud.enable === true) || (theme.comment.use == "valine") { %>
<% if( (theme.leancloud.enable === true) || (theme.comment.use == "valine") ) { %>
<link rel="dns-prefetch" href="https://cdn1.lncld.net"/>
<% } %>
<% if(theme.busuanzi.enable === true) { %>
Expand Down
2 changes: 2 additions & 0 deletions source/js/hanabi-browser-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd20a16

Please sign in to comment.