This directory tree contains assets for customizing usage of André Simon’s Highlight tool, employed to provide syntax highlighting in Asciidoctor conversion to HTML of the project documents.
Table of Contents
/langDefs/
— overrides Highlight default langDefs folder:hugo.lang
v1.1.0 — Hugo syntax definition by Tristano Ajmone.
base16_eighties.theme
— Highlight theme: "Base16 Eighties".highlight.css
— Generated CSS theme from "Base16 Eighties".hugolib.h
— Sample Hugo file.hugolib.h.html
— Sample Hugo file, highlighted output.syntax_test_all-tokens.hug
— Highlight test file.syntax_test_all-tokens.hug.html
— Highlight test file, highlighted output.test.sh
— Bash script to execute tests and convert source to highlighted HTML.tokens-list.hug
— Sample of all Hugo tokens covered by the syntax.tokens-list.hug.html
— Sample of all Hugo tokens, highlighted output.
This folder, beside containing the required assets for the Hugo Book HTML conversion toolchain, also contains some tests and sample for the Hugo syntax.
To execute the tests and convert the sample to HTML, run:
The script will convert all Hugo sources in this folder to syntax highlighted HTML documents, using the custom Hugo syntax from langDefs/hugo.lang
and the "Base16 Eighties" theme from this folder:
The theme file was manually edited to match the actual scheme used in The Hugo Book HTML template.
The following files contain syntax test directive to verify that tokens are highlighted as expected:
syntax_test_all-tokens.hug
/.html
— Contains full list of tokens covered by the Hugo syntax.
If any errors are encountered during the tests, a file named errors.log
will be created in this folder.
The following files don't contain any Highlight tests, and they are intended for previewing how syntax highlighting of Hugo code look like:
hugolib.h
/.html
— Sample from the Hugo Library.tokens-list.hug
/.html
— Sample of all Hugo tokens covered by the syntax.
Here are HTML Live Preview links for the above files (in case you're viewing this on GitHub):
The hugolib sample is intended to provide a real-case example of the look and feel of highlighted code. The tokens lists sample allows visual inspection of all the tokens covered by the Hugo syntax, to check that they are rendered correctly and that no tokens are missing.
NOTE — The
tokens-list.hug
file is auto-generated fromsyntax_test_all-tokens.hug
bytest.sh
via SED. It's just a copy ofsyntax_test_all-tokens.hug
with all test directives lines stripped out, to make the preview more readable.Don't edit the
syntax_test_all-tokens.hug
file! All changes would be overwritten and lost at each execution oftest.sh
.
The Highlight theme uses the following Base16 color scheme:
- Base16 Eighties — by Chris Kempson, MIT License.
The Base16 project was created by Chris Kempson:
The base16_eighties.theme
was taken from André Simon’s Highlight project:
It was then tweaked to match the colors asignments scheme used in The Hugo Book.
The original Highlight theme was converted from YAML by Tristano Ajmone.
The MIT License
Copyright (c) 2018 Tristano Ajmone
Copyright (c) Chris Kempson (http://chriskempson.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The above sample files were taken from the Hugo Library repository on GitHub:
The Hugo Library was created by Ken Tessman and released as part of the Hugo Interactive Fiction project under BSD 2-Clause License:
BSD 2-Clause License
Copyright (c) 2011 by Kent Tessman
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.