CodeWire comes with Prism.js for syntax highlighting and supports all languages listed in the documentation.
The language field value will be set on the surrounding element of the code block so the syntax highlighter knows the language of the example code. You can also use the language field in the top right corner of the code block.
You can optionally display line numbers by adding line-numbers proceeded by a space to the language field.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello CodeWire!</title>
</head>
<body>
<section class="section">
<h1 class="title">
Hello World
</h1>
</section>
</body>
</html>
var numbers = [1, 4, 9];
var doubles = numbers.map(function(num) {
return num * 2;
});
fun dfs(graph: Graph) {
fun dfs(current: Vertex, visited: MutableSet<Vertex>) {
if (!visited.add(current)) return
for (v in current.neighbors)
dfs(v, visited)
}
dfs(graph.vertices[0], HashSet())
}
#!/bin/bash
echo 'How old are you?'
read age
if [ $age -gt 20 ]
then
echo 'You can drive.'
else
echo 'You are too young to drive.'
fi
The theme also supports different styles for terminal input and output.
echo "Hello, $(name)!"
Hello, CodeWire!
LaTeX is most often used for medium-to-large technical or scientific documents. It is extremely useful to write complex formulas with a simple syntax. You can learn learn how to write LaTeX here.
For inline equations, simply surround the LaTex math with a backslash and parentheses: \( LaTex \)
. For example a simple function inline: \( f(x)=(x+a)(x+b) \).
To get a large and centred expression, surround the LaTex math with a backslash and square brackets: \[ LaTex \]
. For example, the Taylor series expansion for the function \( e^x \) is given by:
\[ e^x = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \cdots = \sum_{n\geq 0} \frac{x^n}{n!} \]
In Markdown, you will have to escape some of the control characters, as explained here. Usually, all that needs to be escaped are the surrounding backslashes. To get the same expressions as above, surround the LaTex with double backslashes: \\( LaTex \\)
and \\[ LaTex \\]
.
See how the delimiters are of reasonable size in these examples (either with the new koenig editor or markdown):
\[ \left(a+b\right)\left[1-\frac{b}{a+b}\right]=a\,, \]
\[ \sqrt{|xy|}\leq\left|\frac{x+y}{2}\right|, \]
even when there is no matching delimiter
\[ \int_a^bu\frac{d^2v}{dx^2}\,dx =\left.u\frac{dv}{dx}\right|_a^b -\int_a^b\frac{du}{dx}\frac{dv}{dx}\,dx. \]
whereas vector problems often lead to statements such as
\[ u=\frac{-y}{x^2+y^2}\,,\quad v=\frac{x}{x^2+y^2}\,,\quad\text{and}\quad w=0\,. \]
Arrays of mathematics are typeset using one of the matrix environments as in
\[ \begin{bmatrix} 1 & x & 0 \\ 0 & 1 & -1 \end{bmatrix}\begin{bmatrix} 1 \\ y \\ 1 \end{bmatrix} =\begin{bmatrix} 1+xy \\ y-1 \end{bmatrix}. \] \[ \begin{pmatrix} 2 & 3 & 4\\ 5 & 6 & 7\\ 8 & 9 & 10 \end{pmatrix} v = 0 \]