Add syntax highlighting

This commit is contained in:
Jeremy Dormitzer 2018-07-28 17:23:25 -04:00
parent 3522285fb3
commit c73bd3f8bb
4 changed files with 107 additions and 0 deletions

99
css/highlight-default.css Normal file
View File

@ -0,0 +1,99 @@
/*
Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
/* Base color: saturation 0; */
.hljs,
.hljs-subst {
color: #444;
}
.hljs-comment {
color: #888888;
}
.hljs-keyword,
.hljs-attribute,
.hljs-selector-tag,
.hljs-meta-keyword,
.hljs-doctag,
.hljs-name {
font-weight: bold;
}
/* User color: hue: 0 */
.hljs-type,
.hljs-string,
.hljs-number,
.hljs-selector-id,
.hljs-selector-class,
.hljs-quote,
.hljs-template-tag,
.hljs-deletion {
color: #880000;
}
.hljs-title,
.hljs-section {
color: #880000;
font-weight: bold;
}
.hljs-regexp,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #BC6060;
}
/* Language color: hue: 90; */
.hljs-literal {
color: #78A960;
}
.hljs-built_in,
.hljs-bullet,
.hljs-code,
.hljs-addition {
color: #397300;
}
/* Meta color: hue: 200 */
.hljs-meta {
color: #1f7199;
}
.hljs-meta-string {
color: #4d99bf;
}
/* Misc effects */
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View File

@ -122,12 +122,17 @@ add_action( 'widgets_init', 'jeremy_wordpress_theme_widgets_init' );
function jeremy_wordpress_theme_scripts() { function jeremy_wordpress_theme_scripts() {
wp_enqueue_style( 'fanwood-text-font', get_template_directory_uri() . '/fonts/fanwood-text/stylesheet.css' ); wp_enqueue_style( 'fanwood-text-font', get_template_directory_uri() . '/fonts/fanwood-text/stylesheet.css' );
wp_enqueue_style( 'input-mono-font', get_template_directory_uri() . '/fonts/input-mono/stylesheet.css' ); wp_enqueue_style( 'input-mono-font', get_template_directory_uri() . '/fonts/input-mono/stylesheet.css' );
wp_enqueue_style( 'highlight-style', get_template_directory_uri() . '/css/highlight-default.css' );
wp_enqueue_style( 'jeremy-wordpress-theme-style', get_stylesheet_uri() ); wp_enqueue_style( 'jeremy-wordpress-theme-style', get_stylesheet_uri() );
wp_enqueue_script( 'jeremy-wordpress-theme-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'jeremy-wordpress-theme-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'jeremy-wordpress-theme-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); wp_enqueue_script( 'jeremy-wordpress-theme-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'highlight-js', get_template_directory_uri() . '/js/highlight.pack.js', array(), false, true );
wp_enqueue_script( 'jeremy-wordpress-theme-init', get_template_directory_uri() . '/js/init.js', array('highlight-js'), false, true);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
} }

2
js/highlight.pack.js Normal file

File diff suppressed because one or more lines are too long

1
js/init.js Normal file
View File

@ -0,0 +1 @@
hljs.initHighlightingOnLoad();