Skip to content

Commit 9f068c7

Browse files
committed
Add more info about code blocks example
1 parent a365a01 commit 9f068c7

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

docs/examples.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Examples
22
========
33

4-
Examples are available in the **genja/examples** directory in the genja `GitHub <https://github.com/wigging/genja>`_ repository. Use the ``genja build`` or ``genja serve`` command to generate the HTML for a particular example. For instance, use the command shown below to build the website and run a local server for the **directory-output** example. The website will automatically reload in the web browser when changes are saved to the Markdown files.
4+
Examples are available in the ``genja/examples`` directory in the genja `GitHub <https://github.com/wigging/genja>`_ repository. Use the ``genja build`` or ``genja serve`` command to generate the HTML for a particular example. For instance, use the command shown below to build the website and run a local server for the ``directory-output`` example. The website will automatically reload in the web browser when changes are saved to the Markdown files.
55

66
.. code:: text
77
@@ -18,12 +18,29 @@ Alternatively, use the build command to build the website without starting a loc
1818
Code blocks
1919
-----------
2020

21-
The code-blocks example demonstrates the use of `highlight.js <https://highlightjs.org>`_ to provide syntax coloring of code that is rendered in pages and posts.
21+
The ``code-blocks`` example demonstrates the use of `highlight.js <https://highlightjs.org>`_ to provide syntax coloring of code that is rendered in pages and posts. The CSS and JavaScript for hightlightjs must be defined in the ``<head>...</head>`` section in the HTML page or post template such as:
22+
23+
.. code:: html
24+
25+
<!-- Highlightjs -->
26+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.0/styles/github-dark.min.css">
27+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.0/highlight.min.js"></script>
28+
<script>hljs.highlightAll();</script>
29+
30+
Next, code blocks can be defined in the Markdown files as follows:
31+
32+
.. code:: text
33+
34+
```python
35+
def seyhello():
36+
s = "hello there"
37+
print(s)
38+
```
2239
2340
Directory output
2441
----------------
2542

26-
The directory-output example defines ``site_output = "mysite"`` in the ``genja.toml`` file. This tells Genja to output the generated content to the ``mysite`` directory in the project.
43+
The ``directory-output`` example defines ``site_output = "mysite"`` in the ``genja.toml`` file. This tells Genja to output the generated content to the ``mysite`` directory in the project.
2744

2845
.. code:: text
2946

0 commit comments

Comments
 (0)