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

index.md « shortcodes « post « content « exampleSite - github.com/parsiya/Hugo-Octopress.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cd414cd0f94346e8c054d33725095c88fbdc110a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
title: "Shortcodes In Action"
date: "2021-02-14"
categories:
- Hugo
- Shortcodes
---

The theme's short codes in action. See my shortcode repository at
https://github.com/parsiya/Hugo-Shortcodes for more.

<!--more-->

# Codecaption

**Python**

{{< codecaption title="Python code highlight" lang="python" >}}
from base64 import b64encode
from binascii import unhexlify

print b64encode(unhexlify("0a0b0c0d"))
CgsMDQ==
{{< /codecaption >}}

**Go**

{{< codecaption title="Go highlight" lang="go" >}}
// zlib inflate (decompress).

package main

import (
	"compress/zlib"
	"io"
	"os"
)

func main() {
	zlibFile, err := os.Open("test.zlib")
	if err != nil {
		panic(err)
	}
	defer zlibFile.Close()

	r, err := zlib.NewReader(zlibFile)
	if err != nil {
		panic(err)
	}
	defer r.Close()

	outFile, err := os.Create("out-zlib")
	if err != nil {
		panic(err)
	}
	defer outFile.Close()

	io.Copy(outFile, r)
}
{{< /codecaption >}}


Python code highlight using the Hugo internal `highlight` shortcode:

{{< highlight python >}}
from base64 import b64encode
from binascii import unhexlify

print b64encode(unhexlify("0a0b0c0d"))
CgsMDQ==
{{</highlight >}}

**Test gist1**

{{< gist parsiya 3c18b044bda63d34bdb83eddb66bee4c >}}

**Test gist2**

{{< gist parsiya 423b289016de056671ed6af58e364b99 >}}

**Powershell**

{{< codecaption title="Hello" lang="posh" >}}
# notepad does not have an entry
$ Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad.exe"
False
# chrome does
$ Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe"
True
{{< /codecaption >}}

**Indented code block**

    # notepad does not have an entry
    $ Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad.exe"
    False
    # chrome does
    $ Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe"
    True

# imgcap
{{< imgcap title="The national parks preserve wild life" src="01.jpg" >}}

Image is named `The national parks preserve wild life`. Acquired from the
Library of Congress' "Free to Use and Reuse: Work Projects Administration (WPA)
Posters" collection at https://www.loc.gov/item/98518597/.

The same image using the markdown image tag.

![](01.jpg)