CSSYN

A simple syntax highlighter based on HTML and CSS without JavaScript
Log | Files | Refs | README

commit 3a7ee67fd05ce24b29aa377120b03dde7f21edfc
parent af27c4452074c05314e72851ab96f55e2e9a2556
Author: 0x17 <post@nerdbude.com>
Date:   Wed, 29 Nov 2023 11:59:09 +0000

add files

Diffstat:
Acssyn.css | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aexample.html | 28++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/cssyn.css b/cssyn.css @@ -0,0 +1,67 @@ +/* +8"""8 8"""" 8"""8 8""""8 8""""8 8 8 8""""8 8"""" +8 8 8 8 8 8 8 8 8 8 8 8 8 8 +8e 8 8eeee 8eee8e 8e 8 8eeee8ee 8e 8 8e 8 8eeee +88 8 88 88 8 88 8 88 8 88 8 88 8 88 +88 8 88 88 8 88 8 88 8 88 8 88 8 88 +88 8 88eee 88 8 88eee8 88eeeee8 88ee8 88eee8 88eee + +[website] https://www.nerdbude.com +[mail] post@nerdbude.com +[twitter] @PH_0x17 +[github] https://www.github.com/nerdbude +*/ + +/*just for demo / example.html*/ +#body {background-color: #292929; + color: #ffffff;} + + + +/* code block main style */ + +#cssyn { + background: transparent; + padding: 15px 0 15px 0; + margin: 0 0 2px 0; + border-style: solid; + border-color: #afd75f; + border-width: 1px; + counter-reset: line; + } + +pre {font-family: 'Share Tech Mono', monospace; + padding-left: 15px;} + +ln {font-family: 'Share Tech Mono', monospace;} + +ln::before {content: counter(line, decimal-leading-zero); + background: #282828; + color: #444444; + padding: 0 10px 0 0; + margin: 0 20px 0 0; + border-right: 1px solid #444444; + counter-increment: line; + -webkit-user-select: none; + } + +.label {background-color: #afd75f; + border-style: solid; + border-width: 1px; + border-color: #afd75f; + padding-left: 15px; + padding-right: 15px; + color: #272727;} + +/* single syntax elements as classes */ +/* use in html: <pre class="unix-shell"> $> sudo apt-get install </pre> */ + +.unixshell {color: #87afd7; font-style: italic;} +.comment {color: #8a8a8a;} +.url {color: #00ffd7; font-style: italic; text-decoration: underline;} +.value {color: #875fff;} +.header-file {color: #afd75f;} +.selector {color: #ff5f5f;} +.subselector {color: #ffff5f;} +.unit {color: #ff5f87;} + diff --git a/example.html b/example.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> +<head> + <link rel="stylesheet" type="text/css" href="cssyn.css" media="screen"> +</head> + +<body> +TEST UNIXSHELL:<br> +<div id="cssyn"> + <span class="unixshell"> apt-get install </pre> +</div> +<br> +<br> +TEST CODE:<br> +<br> +<div id="cssyn"> +<pre> + <ln><span class="comment"> /* this is a comment */</span></ln><br> + <ln><span class="header-file"> #include </span>stdio.h<br></ln><br> + <ln><span class="selector">int </span><span class="value">main </span>()</ln></br> + <ln>{</ln></br> + <ln>&emsp;&emsp;&emsp;std::cout <span class="subselector">&lt;&lt; </span><span class="value">"HELLO WORLD!" </span><span class="subselector">&lt;&lt; </span>std::endl;</ln></br> + <ln>}</ln></br> +</pre> +</div> + +</body> +</html>