File tree 3 files changed +38
-31
lines changed
3 files changed +38
-31
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ All this theme are hosted on GitHub pages of the [markdown-css](https://github.c
24
24
The custom HTML template can contain the following variables:
25
25
26
26
- ` {{.html}} ` contains the parsed html code from the markdown;
27
- - ` {{.css}} ` contains the css link obtained by the ` --css ` parameter;
27
+ - ` {{.css}} ` contains a list of css links or codes obtained from the ` --css ` parameter;
28
28
- ` {{.title}} ` contains the first ` h1 ` title, or the ` --title ` parameter if no ` h1 ` title is present in the code.
29
29
30
30
``` shell
@@ -34,12 +34,14 @@ The custom HTML template can contain the following variables:
34
34
We can use a file or a string as ` --html ` parameter (run in bash here):
35
35
36
36
``` shell
37
- > echo " *test*" | gm -t " Test page" -c air --html $' title: {{.title}}\n css: {{.css}}\n html: {{.html}}'
37
+ > echo " *test*" | gm -q - t " Test page" -c air --html $' title: {{.title}}\n css: {{.css}}\n html: {{.html}}'
38
38
title: Test page
39
- css: https://kpym.github.io/markdown-css/air.min.css
39
+ css: [{ https://kpym.github.io/markdown-css/air.min.css }]
40
40
html: < p><em> test< /em></p>
41
41
```
42
42
43
+ The default template is [ gm_template.html] ( gm_template.html ) .
44
+
43
45
## Serve at localhost
44
46
45
47
When used with ` --serve ` /` -s ` flag ` gm ` start serving all files from the specified folder. The ` .md ` files are converted and served as ` html ` but all other files are staticly served. To serve the current folder you can simply run:
@@ -64,7 +66,7 @@ Here is an example of possible `.gitlab-ci.yml`:
64
66
pages :
65
67
image : alpine
66
68
script :
67
- - wget -c https://github.com/kpym/gm/releases/download/v0.18.3 /gm_0.18.3_Linux_64bit .tar.gz -O - | tar -C /usr/local/bin -xz gm
69
+ - wget -c https://github.com/kpym/gm/releases/download/v0.20.0 /gm_0.20.0_Linux_intel64 .tar.gz -O - | tar -C /usr/local/bin -xz gm
68
70
- gm --pages '**/*'
69
71
artifacts :
70
72
paths :
Original file line number Diff line number Diff line change @@ -5,33 +5,9 @@ import (
5
5
)
6
6
7
7
// defaultHTMLTemplate is the default value for `html` flag
8
- var defaultHTMLTemplate string = `<!DOCTYPE html>
9
- <html>
10
- <head>
11
- <meta charset="utf-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
13
- {{- range .css }}
14
- {{- with .Url }}
15
- <link rel="stylesheet" type="text/css" href="{{.}}">
16
- {{- end }}
17
- {{- with .Code }}
18
- {{.}}
19
- {{- end }}
20
- {{- end }}
21
- {{- with .title }}
22
- <title>{{.}}</title>
23
- {{- end }}
24
- </head>
25
- <body>
26
- <article class="markdown-body">
27
- {{.html}}
28
- </article>
29
- {{- if .liveupdate }}
30
- <script src="live.js#html,css"></script>
31
- {{- end }}
32
- </body>
33
- </html>
34
- `
8
+ //
9
+ //go:embed gm_template.html
10
+ var defaultHTMLTemplate string
35
11
36
12
// the favicon image for all served pages
37
13
//
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 ">
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1, shrink-to-fit=no ">
7
+ {{- range .css }}
8
+ {{- with .Url }}
9
+ < link rel ="stylesheet " type ="text/css " href ="{{.}} ">
10
+ {{- end }}
11
+ {{- with .Code }}
12
+ {{.}}
13
+ {{- end }}
14
+ {{- end }}
15
+ {{- with .title }}
16
+ < title > {{.}}</ title >
17
+ {{- end }}
18
+ </ head >
19
+
20
+ < body >
21
+ < article class ="markdown-body ">
22
+ {{.html}}
23
+ </ article >
24
+ {{- if .liveupdate }}
25
+ < script src ="live.js#html,css "> </ script >
26
+ {{- end }}
27
+ </ body >
28
+
29
+ </ html >
You can’t perform that action at this time.
0 commit comments