Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit f4996c7

Browse files
author
Barrie Hadfield
committed
code mirror css matches markdown css closely
1 parent df0ef33 commit f4996c7

File tree

5 files changed

+87
-2
lines changed

5 files changed

+87
-2
lines changed

source/index.html.md.erb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,26 @@ end
1717
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
1818
mode: "text/x-ruby",
1919
matchBrackets: true,
20-
indentUnit: 2
20+
indentUnit: 2,
21+
theme: 'github'
2122
});
2223
</script>
2324

25+
<br>
26+
27+
```ruby
28+
class TestApp < React::Component::Base
29+
param :name
30+
before_mount { @timer = every(1) { force_update! } }
31+
render(DIV) do
32+
h1 {"The current time is #{Time.now}"}
33+
h2 { "here hello #{params.name}" }.on(:click) do
34+
alert "you clicked"
35+
end
36+
end
37+
end
38+
```
39+
2440

2541
## Pure Ruby
2642
Hyperloop lets you build beautiful interactive user interfaces using the same Ruby language running your server side code. Hyperloop replaces JS code, JSX, HTML, templating languages, and complex frameworks with one simple system.

source/layout.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
<%= stylesheet_link_tag 'bootstrap.min.css' %>
3232
<%= stylesheet_link_tag 'override.css' %>
3333
<!-- <%= stylesheet_link_tag 'code.css' %> -->
34+
<%= stylesheet_link_tag 'github.css' %>
35+
<%= stylesheet_link_tag 'highlighting.css' %>
3436
<%= stylesheet_link_tag 'codemirror.css' %>
3537

3638
<%= feed_tag :atom, "#{blog.options.prefix.to_s}/feed.xml", title: "Atom Feed" %>

source/stylesheets/codemirror.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
238238
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
239239
border-width: 0;
240240
background: transparent;
241-
font-family: inherit;
241+
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
242242
font-size: inherit;
243243
margin: 0;
244244
white-space: pre;

source/stylesheets/github.css

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.cm-s-github {
2+
font-size: 0.95em;
3+
line-height: 1.4em;
4+
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
5+
letter-spacing: 0.0px;
6+
word-spacing: 0px;
7+
background: #F8F8FF;
8+
color: #000000;
9+
}
10+
.cm-s-github .CodeMirror-lines {
11+
padding: 8px 0;
12+
}
13+
.cm-s-github .CodeMirror-gutters {
14+
box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.5);
15+
-webkit-box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.5);
16+
background-color: #F8F8FF;
17+
padding-right: 10px;
18+
z-index: 3;
19+
border: none;
20+
}
21+
.cm-s-github div.CodeMirror-cursor {
22+
border-left: 3px solid #000000;
23+
}
24+
.cm-s-github .CodeMirror-activeline-background {
25+
background: #00000012;
26+
}
27+
.cm-s-github .CodeMirror-selected {
28+
background: #BCD5FA;
29+
}
30+
.cm-s-github .cm-comment {
31+
font-style: italic;
32+
color: #999988;
33+
}
34+
.cm-s-github .cm-number {
35+
color: null;
36+
}
37+
.cm-s-github .cm-atom {
38+
color: #445588;
39+
}
40+
.cm-s-github .cm-string {
41+
color: #DD1144;
42+
}
43+
.cm-s-github .cm-variable-2 {
44+
color: #121289;
45+
}
46+
.cm-s-github .cm-variable {
47+
color: #445588;
48+
}
49+
.cm-s-github .cm-property {
50+
color: #990000;
51+
font-weight: bold;
52+
}
53+
.cm-s-github .cm-keyword {
54+
color: null;
55+
font-weight: bold;
56+
}
57+
.cm-s-github .cm-tag {
58+
color: #445588;
59+
}
60+
61+
.cm-s-github .cm-operator {
62+
color: null;
63+
}
64+
.cm-s-github .CodeMirror-linenumber {
65+
color: italic;
66+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= Rouge::Themes::Github.render(:scope => '.highlight') %>

0 commit comments

Comments
 (0)