Added syntax highlighing for |code| cards.

This commit is contained in:
Nilesh PS
2017-02-26 13:38:55 +05:30
parent c037ddbedc
commit d2bd4fa9cf
5 changed files with 106 additions and 3 deletions

View File

@@ -0,0 +1,99 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.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
static/highlight.pack.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -57,7 +57,7 @@
{% 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>

View File

@@ -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">

View File

@@ -47,7 +47,7 @@
</div>
{% endif %}
{% else %}
<pre>{{ card.back|safe }}</pre>
<pre><code>{{ card.back|safe }}</code></pre>
{% endif %}
</div>
</div>