Syntax Highlighting

This commit is contained in:
Out Of Ideas 2024-03-16 16:33:52 -05:00
parent 9701fc47d0
commit 68e78c255d
1 changed files with 189 additions and 0 deletions

189
syntax-highlighting.html Normal file
View File

@ -0,0 +1,189 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Syntax Highlighting</title>
<!--
Syntax Highlinging based off of Vis theming (https://github.com/martanne/vis/wiki/Themes).
Command line syntax highlighting is based off of a ZSH plugin, F-Sy-H (https://github.com/z-shell/F-Sy-H/blob/main/themes/default.ini).
Any affect of syntax highlighting should not be present in terminal browseres.
Prompts should be made bold with the <strong> tag (also making it bold in the terminal).
In terminal browsers, inline code should be bold, hence the <b> tag. Regular bold text shoud use the <strong> tag.
Current colorscheme: Gruvbox Dark
-->
<style type="text/css">
.class {
color: #fabd2f
} .comment {
color: #928374;
font-style: italic
} .constant {
color: #d3869b
} .definition {
color: #fabd2f
} .error {
background-color: #fb4934
} .function {
color: #b8bb26;
font-weight: bold
} .keyword {
color: #fb4934
} .label {
color: #fb4934
} .number {
color: #d3869b
} .operator {
color: #ebdbb2
} .regex {
color: #8ec07c
} .string {
color: #b8bb26
} .preprocessor {
color: #8ec07c
} .tag {
color: #83a598
} .type {
color: #fabd2f
} .variable {
color: #83a598
} .embeded {
color: #fe8019
} .identifier {
color: #83a598
} .addition {
background-color: #b8bb26;
font-weight: bold
} .deletion: {
background-color: #fb4934;
font-weight: bold
} .cmd {
color: #98971A
} .flag {
color: #689D6A
} .quoted {
color: #D79921
} .history-expansion {
color: #83A598;
font-weight: bold
} .path {
color: #B16286;
text-decoration: underline
} .cmd-line-var: {
color: #689D6A
} .cmd-line-error {
color: #FB4934;
font-weight: bold
} .reserved {
color: #D79921
} .cmd-line-comment {
color: #928374;
font-weight: bold
} body {
margin: 40px auto;
max-width: 650px;
line-height: 1.6;
font-size: 18px;
padding: 0 10px;
color: #EBDBB2;
background-color: #1d2021
} h1 {
line-height: 1.2
} b, pre {
font-family: monospace;
font-weight: normal;
font-size: 14px
} h1 {
border-bottom: 1px solid #A89984
} a:link {
color: #458588
} a:visited {
color: #B16286
}
</style>
</head>
<body>
<h1>Syntax Highlighting</h1>
<h2>Command Line Example</h2>
<!--
Code:
# ls -a
-->
<pre>
<strong>#</strong> <span class="cmd">ls</span> <span class="flag">-a</span>
</pre>
<!--
/* Adding Vectors
*
* A Program that adds vectors given the components.
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
float u1, u2, v1, v2; /* Components */
/* Prompt user for variables */
printf("Enter the first component of vector 𝐮 (𝑢₁): ");
scanf("%f", &u1);
printf("Enter the second component of vector 𝐮 (𝑢₂): ");
scanf("%f", &u2);
printf("Enter the first component of vector 𝐯 (𝑣₁): ");
scanf("%f", &v1);
printf("Enter the second component of vector 𝐯 (𝑣₂): ");
scanf("%f", &v2);
/* Print the sum of the vectors */
printf("𝐮 + 𝐯 = <%.2f, %.2f>\n", u1 + v1, u2 + v2);
return 0;
}
-->
<h2>C Example</h2>
<pre>
<span class="comment">/* Adding Vectors
*
* A Program that adds vectors given the components.
*/</span>
<span class="preprocessor">#include</span> <span class="string">&ltstdio.h&gt</span>
<span class="preprocessor">#include</span> <span class="string">&ltstdlib.h&gt</span>
<span class="type">int</span> <span class="variable">main</span>() {
<span class="type">float</span> <span class="variable">u1</span>, <span class="variable">u2</span>, <span class="variable">v1</span>, <span class="variable">u1</span>, <span class="variable">v2</span>; <span class="comment">/* Components */</span>
<span class="comment">/* Prompt user for variables */</span>
<span class="variable">printf</span>(<span class="string">"Enter the first component of vector 𝐮 (𝑢₁): "</span>);
<span class="variable">scanf</span>(<span class="string">"%f"</span>, &amp<span class="variable">u1</span>);
<span class="variable">printf</span>(<span class="string">"Enter the second component of vector 𝐮 (𝑢₂): "</span>);
<span class="variable">scanf</span>(<span class="string">"%f"</span>, &amp<span class="variable">u2</span>);
<span class="variable">printf</span>(<span class="string">"Enter the first component of vector 𝐯 (𝑣₁): "</span>);
<span class="variable">scanf</span>(<span class="string">"%f"</span>, &amp<span class="variable">v1</span>);
<span class="variable">printf</span>(<span class="string">"Enter the second component of vector 𝐯 (𝑣₂): "</span>);
<span class="variable">scanf</span>(<span class="string">"%f"</span>, &amp<span class="variable">v2</span>);
<span class="comment">/* Print the sum of the vectors */</span>
<span class="variable">printf</span>(<span class="string">"𝐮 + 𝐯 = &lt%.2f, %.2f&gt\n"</span>, <span class="variable">u1</span> <span class="operator">+</span> <span class="variable">v1</span>, <span class="variable">u2</span> <span class="operator">+</span> <span class="variable">v2</span>);
<span class="keyword">return</span> <span class="number">0</span>;
}
</pre>
</body>
</html>