1
0
mirror of https://github.com/til-schneider/slim-wiki.git synced 2025-08-07 00:56:35 +02:00

Added syntax highlighting

This commit is contained in:
til-schneider
2015-12-20 22:24:16 +01:00
parent 4e394d9ed7
commit 4d253598ba
22 changed files with 14806 additions and 20 deletions

View File

@@ -33,5 +33,6 @@ Used libraries
--------------
- [Parsedown](https://github.com/erusev/parsedown/) - PHP markdown parser
- [highlight.js](https://highlightjs.org/) - JavaScript syntax highlighter
Slim wiki is inspired by [Wikitten](https://github.com/victorstanciu/Wikitten).

3
src/.bowerrc Normal file
View File

@@ -0,0 +1,3 @@
{
"directory": "client/libs"
}

View File

@@ -10,7 +10,7 @@ module.exports = function (grunt) {
'less',
'useminPrepare',
'concat',
//'uglify', // TODO: uncomment if there is JavaScript
'uglify',
'cssmin',
'usemin'
]);
@@ -43,7 +43,7 @@ module.exports = function (grunt) {
dist: {
files: (function () {
var files = {};
files[dist + '/client/css/style.css'] = 'client/less/style.less';
files['.tmp/app-view.css'] = 'client/less/app-view.less';
return files;
})()
}

View File

@@ -42,16 +42,25 @@ Numbered lists:
And now some code:
// Code is just text indented a bit
which(is_easy) to_remember();
which(isEasy) toRemember();
~~~
// Un-indented code blocks work too
if (this_is_more_code == true && !indented) {
if (thisIsMoreCode == true && !indented) {
// tild wrapped code blocks, also not indented
}
~~~
Backticks and language selection for syntax highlighting work too:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<some-tag with="argument">And text</some-tag>
</root>
```
Text with
two trailing spaces
(on the right)
@@ -64,11 +73,13 @@ for things like poems
****
--------------------------
### Embedded HTML
<div style="font-size: 20px; color:green; text-shadow: 4px 4px 2px rgba(0, 0, 0, 0.3);">
This is <b>embedded HTML</b>
</div>
## Tables ##
### Tables
| Header | Header | Right |
| ------ | ------ | -----: |

7
src/bower.json Normal file
View File

@@ -0,0 +1,7 @@
{
"name": "slim-wiki",
"version": "0.0.0",
"dependencies": {
"highlightjs": "9.0.0"
}
}

1
src/client/js/Main.js Normal file
View File

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

View File

@@ -1,6 +1,7 @@
.markdown-body {
font-size: 16px;
color: #666;
line-height: 1.4;
p, blockquote, ul, ol, dl, li, table, pre, h5, h6 {
margin: 15px 0;
@@ -49,30 +50,30 @@
color: #888;
}
code, pre {
border-radius: 3px;
background-color: #F8F8F8;
font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace;
color: inherit;
}
code {
border: 1px solid #EAEAEA;
border-radius: 3px;
background-color: #F8F8F8; // #232323;
font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0 2px;
padding: 0 5px;
}
pre {
border: 1px solid #CCCCCC;
line-height: 1.2;
overflow: auto;
padding: 6px 10px;
}
pre > code {
border: 0;
margin: 0;
padding: 0;
display: block;
border: 1px solid #CCCCCC;
line-height: 1.2;
margin: 20px 0;
padding: 15px 10px;
}
code .hljs-tag {
background: transparent; // No special background for XML/HTML tags
}
table {

View File

@@ -0,0 +1,24 @@
{
"name": "highlightjs",
"version": "9.0.0",
"main": [
"highlight.pack.js",
"styles/default.css"
],
"ignore": [
"**/.*",
"node_modules",
"vendor",
"components"
],
"homepage": "https://github.com/components/highlightjs",
"_release": "9.0.0",
"_resolution": {
"type": "version",
"tag": "9.0.0",
"commit": "fbbd6eea988fd759d950e15b8d16fef559eebca2"
},
"_source": "git://github.com/components/highlightjs.git",
"_target": "9.0.0",
"_originalSource": "highlightjs"
}

View File

@@ -0,0 +1,24 @@
Copyright (c) 2006, Ivan Sagalaev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of highlight.js nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,108 @@
/*!
* Agate by Taufik Nurrohman <https://github.com/tovic>
* ----------------------------------------------------
*
* #ade5fc
* #a2fca2
* #c6b4f0
* #d36363
* #fcc28c
* #fc9b9b
* #ffa
* #fff
* #333
* #62c8f3
* #888
*
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #333;
color: white;
}
.hljs-name,
.hljs-strong {
font-weight: bold;
}
.hljs-code,
.hljs-emphasis {
font-style: italic;
}
.hljs-tag {
color: #62c8f3;
}
.hljs-variable,
.hljs-template-variable,
.hljs-selector-id,
.hljs-selector-class {
color: #ade5fc;
}
.hljs-string,
.hljs-bullet {
color: #a2fca2;
}
.hljs-type,
.hljs-title,
.hljs-section,
.hljs-attribute,
.hljs-quote,
.hljs-built_in,
.hljs-builtin-name {
color: #ffa;
}
.hljs-number,
.hljs-symbol,
.hljs-bullet {
color: #d36363;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal {
color: #fcc28c;
}
.hljs-comment,
.hljs-deletion,
.hljs-code {
color: #888;
}
.hljs-regexp,
.hljs-link {
color: #c6b4f0;
}
.hljs-meta {
color: #fc9b9b;
}
.hljs-deletion {
background-color: #fc9b9b;
color: #333;
}
.hljs-addition {
background-color: #a2fca2;
color: #333;
}
.hljs a {
color: inherit;
}
.hljs a:focus,
.hljs a:hover {
color: inherit;
text-decoration: underline;
}

View File

@@ -0,0 +1,66 @@
/*
Date: 24 Fev 2015
Author: Pedro Oliveira <kanytu@gmail . com>
*/
.hljs {
color: #a9b7c6;
background: #282b2e;
display: block;
overflow-x: auto;
padding: 0.5em;
}
.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet {
color: #6897BB;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-deletion {
color: #cc7832;
}
.hljs-variable,
.hljs-template-variable,
.hljs-link {
color: #629755;
}
.hljs-comment,
.hljs-quote {
color: #808080;
}
.hljs-meta {
color: #bbb529;
}
.hljs-string,
.hljs-attribute,
.hljs-addition {
color: #6A8759;
}
.hljs-section,
.hljs-title,
.hljs-type {
color: #ffc66d;
}
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: #e8bf6a;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View File

@@ -0,0 +1,71 @@
/*
Colorbrewer theme
Original: https://github.com/mbostock/colorbrewer-theme (c) Mike Bostock <mike@ocks.org>
Ported by Fabrício Tavares de Oliveira
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #fff;
}
.hljs,
.hljs-subst {
color: #000;
}
.hljs-string,
.hljs-meta,
.hljs-symbol,
.hljs-template-tag,
.hljs-template-variable,
.hljs-addition {
color: #756bb1;
}
.hljs-comment,
.hljs-quote {
color: #636363;
}
.hljs-number,
.hljs-regexp,
.hljs-literal,
.hljs-bullet,
.hljs-link {
color: #31a354;
}
.hljs-deletion,
.hljs-variable {
color: #88f;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-title,
.hljs-section,
.hljs-built_in,
.hljs-doctag,
.hljs-type,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-strong {
color: #3182bd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-attribute {
color: #e6550d;
}

View File

@@ -0,0 +1,77 @@
/*
Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
.hljs,
.hljs-subst {
color: #444;
}
.hljs-keyword,
.hljs-attribute,
.hljs-selector-tag,
.hljs-meta-keyword,
.hljs-doctag,
.hljs-name {
font-weight: bold;
}
.hljs-built_in,
.hljs-literal,
.hljs-bullet,
.hljs-code,
.hljs-addition {
color: #1F811F;
}
.hljs-regexp,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #BC6060;
}
.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-comment {
color: #888888;
}
.hljs-meta {
color: #2B6EA1;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

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;
}

View File

@@ -0,0 +1,102 @@
/*
vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
*/
/*background color*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #1d1f21;
}
/*selection color*/
.hljs::selection,
.hljs span::selection {
background: #373b41;
}
.hljs::-moz-selection,
.hljs span::-moz-selection {
background: #373b41;
}
/*foreground color*/
.hljs {
color: #c5c8c6;
}
/*color: fg_yellow*/
.hljs-title,
.hljs-name {
color: #f0c674;
}
/*color: fg_comment*/
.hljs-comment,
.hljs-meta,
.hljs-meta .hljs-keyword {
color: #707880;
}
/*color: fg_red*/
.hljs-number,
.hljs-symbol,
.hljs-literal,
.hljs-deletion,
.hljs-link {
color: #cc6666
}
/*color: fg_green*/
.hljs-string,
.hljs-doctag,
.hljs-addition,
.hljs-regexp,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #b5bd68;
}
/*color: fg_purple*/
.hljs-attribute,
.hljs-code,
.hljs-selector-id {
color: #b294bb;
}
/*color: fg_blue*/
.hljs-keyword,
.hljs-selector-tag,
.hljs-bullet,
.hljs-tag {
color: #81a2be;
}
/*color: fg_aqua*/
.hljs-subst,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
color: #8abeb7;
}
/*color: fg_orange*/
.hljs-type,
.hljs-built_in,
.hljs-builtin-name,
.hljs-quote,
.hljs-section,
.hljs-selector-class {
color: #de935f;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View File

@@ -0,0 +1,97 @@
/*
Intellij Idea-like styling (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #000;
background: #fff;
}
.hljs-subst,
.hljs-title {
font-weight: normal;
color: #000;
}
.hljs-comment,
.hljs-quote {
color: #808080;
font-style: italic;
}
.hljs-meta {
color: #808000;
}
.hljs-tag {
background: #efefef;
}
.hljs-section,
.hljs-name,
.hljs-literal,
.hljs-keyword,
.hljs-selector-tag,
.hljs-type,
.hljs-selector-id,
.hljs-selector-class {
font-weight: bold;
color: #000080;
}
.hljs-attribute,
.hljs-number,
.hljs-regexp,
.hljs-link {
font-weight: bold;
color: #0000ff;
}
.hljs-number,
.hljs-regexp,
.hljs-link {
font-weight: normal;
}
.hljs-string {
color: #008000;
font-weight: bold;
}
.hljs-symbol,
.hljs-bullet,
.hljs-formula {
color: #000;
background: #d0eded;
font-style: italic;
}
.hljs-doctag {
text-decoration: underline;
}
.hljs-variable,
.hljs-template-variable {
color: #660e7a;
}
.hljs-addition {
background: #baeeba;
}
.hljs-deletion {
background: #ffc8bd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View File

@@ -0,0 +1,106 @@
/*
Railscasts-like style (c) Visoft, Inc. (Damien White)
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #232323;
color: #e6e1dc;
}
.hljs-comment,
.hljs-quote {
color: #bc9458;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag {
color: #c26230;
}
.hljs-string,
.hljs-number,
.hljs-regexp,
.hljs-variable,
.hljs-template-variable {
color: #a5c261;
}
.hljs-subst {
color: #519f50;
}
.hljs-tag,
.hljs-name {
color: #e8bf6a;
}
.hljs-type {
color: #da4939;
}
.hljs-symbol,
.hljs-bullet,
.hljs-built_in,
.hljs-builtin-name,
.hljs-attr,
.hljs-link {
color: #6d9cbe;
}
.hljs-params {
color: #d0d0ff;
}
.hljs-attribute {
color: #cda869;
}
.hljs-meta {
color: #9b859d;
}
.hljs-title,
.hljs-section {
color: #ffc66d;
}
.hljs-addition {
background-color: #144212;
color: #e6e1dc;
display: inline-block;
width: 100%;
}
.hljs-deletion {
background-color: #600;
color: #e6e1dc;
display: inline-block;
width: 100%;
}
.hljs-selector-class {
color: #9b703f;
}
.hljs-selector-id {
color: #8b98ab;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
.hljs-link {
text-decoration: underline;
}

View File

@@ -0,0 +1,102 @@
/*
Sunburst-like style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #000;
color: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #aeaeae;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #e28964;
}
.hljs-string {
color: #65b042;
}
.hljs-subst {
color: #daefa3;
}
.hljs-regexp,
.hljs-link {
color: #e9c062;
}
.hljs-title,
.hljs-section,
.hljs-tag,
.hljs-name {
color: #89bdff;
}
.hljs-class .hljs-title,
.hljs-doctag {
text-decoration: underline;
}
.hljs-symbol,
.hljs-bullet,
.hljs-number {
color: #3387cc;
}
.hljs-params,
.hljs-variable,
.hljs-template-variable {
color: #3e87e3;
}
.hljs-attribute {
color: #cda869;
}
.hljs-meta {
color: #8996a8;
}
.hljs-formula {
background-color: #0e2231;
color: #f8f8f8;
font-style: italic;
}
.hljs-addition {
background-color: #253b22;
color: #f8f8f8;
}
.hljs-deletion {
background-color: #420e09;
color: #f8f8f8;
}
.hljs-selector-class {
color: #9b703f;
}
.hljs-selector-id {
color: #8b98ab;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View File

@@ -0,0 +1,75 @@
/* Tomorrow Night Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
color: #969896;
}
/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
color: #cc6666;
}
/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
color: #de935f;
}
/* Tomorrow Yellow */
.hljs-attribute {
color: #f0c674;
}
/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
color: #b5bd68;
}
/* Tomorrow Blue */
.hljs-title,
.hljs-section {
color: #81a2be;
}
/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #b294bb;
}
.hljs {
display: block;
overflow-x: auto;
background: #1d1f21;
color: #c5c8c6;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View File

@@ -9,12 +9,26 @@
<base href="<?php echo $baseUrl; ?>/">
<!-- build:css client/css/style.css -->
<link rel="stylesheet" href="../dist/client/css/style.css">
<!-- build:css client/view.css -->
<!--
| Styles see: https://highlightjs.org/static/demo/
| Good bright styles: default, color-brewer, github, idea
| Good dark styles: agate, androidstudio, hybrid, railscasts, sunburst, tomorrow-night
+-->
<link rel="stylesheet" href="client/libs/highlightjs/styles/idea.css">
<link href=".tmp/app-view.css" rel="stylesheet" />
<!-- endbuild -->
</head>
<body>
<article class="markdown-body"><?php echo $articleMarkup; ?></article>
</body>
<!-- build:js client/view.js -->
<script src="client/libs/highlightjs/highlight.pack.js"></script>
<script src="client/js/Main.js"></script>
<!-- endbuild -->
</html>