Skip to content

Commit aace071

Browse files
committed
fix bc style breaks from rouge 3.x (#1226)
* fix bc style breaks from rouge 3.x Signed-off-by: Matthew Peveler <[email protected]> * use bright_pink for Name::Label Signed-off-by: Matthew Peveler <[email protected]>
1 parent 33c4acc commit aace071

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

config.rb

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# Activate the syntax highlighter
2424
activate :syntax
2525
ready do
26+
require './lib/monokai_sublime_slate.rb'
2627
require './lib/multilang.rb'
2728
end
2829

lib/monokai_sublime_slate.rb

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# -*- coding: utf-8 -*- #
2+
# frozen_string_literal: true
3+
4+
# this is based on https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/monokai_sublime.rb
5+
# but without the added background, and changed styling for JSON keys to be soft_yellow instead of white
6+
7+
module Rouge
8+
module Themes
9+
class MonokaiSublimeSlate < CSSTheme
10+
name 'monokai.sublime.slate'
11+
12+
palette :black => '#000000'
13+
palette :bright_green => '#a6e22e'
14+
palette :bright_pink => '#f92672'
15+
palette :carmine => '#960050'
16+
palette :dark => '#49483e'
17+
palette :dark_grey => '#888888'
18+
palette :dark_red => '#aa0000'
19+
palette :dimgrey => '#75715e'
20+
palette :emperor => '#555555'
21+
palette :grey => '#999999'
22+
palette :light_grey => '#aaaaaa'
23+
palette :light_violet => '#ae81ff'
24+
palette :soft_cyan => '#66d9ef'
25+
palette :soft_yellow => '#e6db74'
26+
palette :very_dark => '#1e0010'
27+
palette :whitish => '#f8f8f2'
28+
palette :orange => '#f6aa11'
29+
palette :white => '#ffffff'
30+
31+
style Generic::Heading, :fg => :grey
32+
style Literal::String::Regex, :fg => :orange
33+
style Generic::Output, :fg => :dark_grey
34+
style Generic::Prompt, :fg => :emperor
35+
style Generic::Strong, :bold => false
36+
style Generic::Subheading, :fg => :light_grey
37+
style Name::Builtin, :fg => :orange
38+
style Comment::Multiline,
39+
Comment::Preproc,
40+
Comment::Single,
41+
Comment::Special,
42+
Comment, :fg => :dimgrey
43+
style Error,
44+
Generic::Error,
45+
Generic::Traceback, :fg => :carmine
46+
style Generic::Deleted,
47+
Generic::Inserted,
48+
Generic::Emph, :fg => :dark
49+
style Keyword::Constant,
50+
Keyword::Declaration,
51+
Keyword::Reserved,
52+
Name::Constant,
53+
Keyword::Type, :fg => :soft_cyan
54+
style Literal::Number::Float,
55+
Literal::Number::Hex,
56+
Literal::Number::Integer::Long,
57+
Literal::Number::Integer,
58+
Literal::Number::Oct,
59+
Literal::Number,
60+
Literal::String::Char,
61+
Literal::String::Escape,
62+
Literal::String::Symbol, :fg => :light_violet
63+
style Literal::String::Doc,
64+
Literal::String::Double,
65+
Literal::String::Backtick,
66+
Literal::String::Heredoc,
67+
Literal::String::Interpol,
68+
Literal::String::Other,
69+
Literal::String::Single,
70+
Literal::String, :fg => :soft_yellow
71+
style Name::Attribute,
72+
Name::Class,
73+
Name::Decorator,
74+
Name::Exception,
75+
Name::Function, :fg => :bright_green
76+
style Name::Variable::Class,
77+
Name::Namespace,
78+
Name::Entity,
79+
Name::Builtin::Pseudo,
80+
Name::Variable::Global,
81+
Name::Variable::Instance,
82+
Name::Variable,
83+
Text::Whitespace,
84+
Text,
85+
Name, :fg => :white
86+
style Name::Label, :fg => :bright_pink
87+
style Operator::Word,
88+
Name::Tag,
89+
Keyword,
90+
Keyword::Namespace,
91+
Keyword::Pseudo,
92+
Operator, :fg => :bright_pink
93+
end
94+
end
95+
end

source/layouts/layout.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ under the License.
3232
<title><%= current_page.data.title || "API Documentation" %></title>
3333

3434
<style>
35-
<%= Rouge::Themes::MonokaiSublime.render(:scope => '.highlight') %>
35+
<%= Rouge::Themes::MonokaiSublimeSlate.render(:scope => '.highlight') %>
3636
</style>
3737
<%= stylesheet_link_tag :screen, media: :screen %>
3838
<%= stylesheet_link_tag :print, media: :print %>

source/stylesheets/screen.css.scss

+4
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ html, body {
511511
// This is all the stuff that appears in the right half of the page
512512

513513
.content {
514+
&>div.highlight {
515+
clear:none;
516+
}
517+
514518
pre, blockquote {
515519
background-color: $code-bg;
516520
color: #fff;

0 commit comments

Comments
 (0)