Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/monkeyWzr/hugo-theme-cactus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonkeyWzr <monkeywzr@gmail.com>2021-06-27 12:59:35 +0300
committermonkeyWzr <monkeywzr@gmail.com>2021-06-27 12:59:35 +0300
commite72e1d9573cbf1a3a28af1c00e186a415189c02e (patch)
treea4dd1ef55c2a3f5a250e299a93b1bf049c9cd5a9
parent3daa2eca9a822dd47b218fec463eb285f6fb1932 (diff)
update example site's config; add code block test
-rw-r--r--exampleSite/config.toml16
-rw-r--r--exampleSite/content/posts/code-block-test.md125
2 files changed, 138 insertions, 3 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index f10a3b0..1bad204 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -1,7 +1,7 @@
baseURL = "https://example.com"
languageCode = "en-us"
title = "Cactus theme example"
-theme = "cactus"
+theme = "hugo-theme-cactus"
copyright = "You" # cactus will use title if copyright is not set
disqusShortname = "example" # Used when comments is enabled. Cactus will use site title if not set
# googleAnalytics = "UA-1234-5"
@@ -35,6 +35,16 @@ weight = 4
endLevel = 4
ordered = false
startLevel = 2
+ [markup.highlight]
+ codeFences = true
+ guessSyntax = false
+ hl_Lines = ""
+ lineNoStart = 1
+ lineNos = true
+ lineNumbersInTable = true
+ noClasses = true
+ style = "dracula"
+ tabWidth = 4
[params]
@@ -55,8 +65,8 @@ weight = 4
dateFormat = "2006-01-02" # default
# Post page settings
- show_updated = false # default
- showReadTime = false # default
+ show_updated = true # default
+ showReadTime = true # default
[params.comments]
enabled = false # default
diff --git a/exampleSite/content/posts/code-block-test.md b/exampleSite/content/posts/code-block-test.md
new file mode 100644
index 0000000..af384f2
--- /dev/null
+++ b/exampleSite/content/posts/code-block-test.md
@@ -0,0 +1,125 @@
+---
+title: Code Block Test
+date: 2021-06-27 09:00:00
+tags:
+ - test
+categories:
+ - tech
+keywords:
+ - markdown
+ - code block
+---
+
+
+`String`
+
+Using indents:
+
+ text
+ text
+ text
+
+
+Fenced code block:
+
+```
+text
+text
+<tag>
+```
+
+Fenced code block with language:
+
+```Java
+// Java
+public final class String
+ implements java.io.Serializable, Comparable<String>, CharSequence
+{
+ /** The value is used for character storage. */
+ private final char value[];
+
+ /** The offset is the first index of the storage that is used. */
+ private final int offset;
+
+ /** The count is the number of characters in the String. */
+ private final int count;
+
+ /** Cache the hash code for the string */
+ private int hash; // Default to 0
+
+ // ...
+
+ // Package private constructor which shares value array for speed.
+ String(int offset, int count, char value[]) {
+ this.value = value;
+ this.offset = offset;
+ this.count = count;
+ }
+
+ // ...
+
+ /**
+ * Returns a new string that is a substring of this string. The
+ * substring begins at the specified <code>beginIndex</code> and
+ * extends to the character at index <code>endIndex - 1</code>.
+ * Thus the length of the substring is <code>endIndex-beginIndex</code>.
+ * <p>
+ * Examples:
+ * <blockquote><pre>
+ * "hamburger".substring(4, 8) returns "urge"
+ * "smiles".substring(1, 5) returns "mile"
+ * </pre></blockquote>
+ *
+ * @param beginIndex the beginning index, inclusive.
+ * @param endIndex the ending index, exclusive.
+ * @return the specified substring.
+ * @exception IndexOutOfBoundsException if the
+ * <code>beginIndex</code> is negative, or
+ * <code>endIndex</code> is larger than the length of
+ * this <code>String</code> object, or
+ * <code>beginIndex</code> is larger than
+ * <code>endIndex</code>.
+ */
+ public String substring(int beginIndex, int endIndex) {
+ if (beginIndex < 0) {
+ throw new StringIndexOutOfBoundsException(beginIndex);
+ }
+ if (endIndex > count) {
+ throw new StringIndexOutOfBoundsException(endIndex);
+ }
+ if (beginIndex > endIndex) {
+ throw new StringIndexOutOfBoundsException(endIndex - beginIndex);
+ }
+ return ((beginIndex == 0) && (endIndex == count)) ? this :
+ new String(offset + beginIndex, endIndex - beginIndex, value);
+ }
+
+ // ...
+}
+```
+
+Using hugo's `highlight` [shortcode]([highlight](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode)):
+
+{{< highlight typescript "linenos=table, hl_lines=8 18-21" >}}
+// TypeScript
+type OptionalUser = {
+ [K in keyof User]?: User[K]
+}
+
+// ! we can remove optional constraint
+type RequiredUser = {
+ [K in keyof OptionalUser]-?: User[K]
+}
+
+type NullableUser = {
+ [K in keyof User]: User[K] | null
+}
+type ReadonlyUser = {
+ readonly [K in keyof User]: User[K]
+}
+
+// ! we can remove readonly constraint
+type ModifiableUser = {
+ -readonly [K in keyof User]: User[K]
+}
+{{< /highlight >}}