This repository has been archived on 2024-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
blogs/syntax-highlighting.html

183 lines
5.4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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).
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;
border-bottom: 1px solid #A89984
} b.inline, pre {
font-family: monospace;
font-weight: normal;
font-size: 14px
} 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>