Skip to content

Commit

Permalink
Added syntax highlighing for |code| cards.
Browse files Browse the repository at this point in the history
  • Loading branch information
psnilesh committed Feb 26, 2017
1 parent c037ddb commit d2bd4fa
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 3 deletions.
99 changes: 99 additions & 0 deletions static/highlight-theme-github.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
github.com style (c) Vasily Polovnyov <[email protected]>
*/

.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}

.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}

.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}

.hljs-string,
.hljs-doctag {
color: #d14;
}

.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}

.hljs-subst {
font-weight: normal;
}

.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}

.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}

.hljs-regexp,
.hljs-link {
color: #009926;
}

.hljs-symbol,
.hljs-bullet {
color: #990073;
}

.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}

.hljs-meta {
color: #999;
font-weight: bold;
}

.hljs-deletion {
background: #fdd;
}

.hljs-addition {
background: #dfd;
}

.hljs-emphasis {
font-style: italic;
}

.hljs-strong {
font-weight: bold;
}
2 changes: 2 additions & 0 deletions static/highlight.pack.js

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

2 changes: 1 addition & 1 deletion templates/cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h4>
{% if card.type == 1 %}
{{ card.back|replace("\n", "<br />")|safe }}
{% else %}
<pre>{{ card.back|safe }}</pre>
<pre><code>{{ card.back|safe }}</code></pre>
{% endif %}
</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"/>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='hightlight-theme-github.css') }}" />
<script src="{{ url_for('static', filename='highlight.pack.js') }}"></script>
</head>
<body>
<div class="container">
Expand Down
4 changes: 2 additions & 2 deletions templates/memorize.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h3 class="text-center">{{ card.front }}</h3>
</div>
{% endif %}
{% else %}
<pre>{{ card.back|safe }}</pre>
<pre><code>{{ card.back|safe }}</code></pre>
{% endif %}
</div>
</div>
Expand Down Expand Up @@ -100,4 +100,4 @@ <h3 class="text-center">{{ card.front }}</h3>
</div>
</div>

{% endblock %}
{% endblock %}

0 comments on commit d2bd4fa

Please sign in to comment.