add image support

This commit is contained in:
sad 2024-03-09 19:37:40 -07:00
parent e7570ce7af
commit 90af93ecbe
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 28D3A882F3E6AD02
18 changed files with 7433 additions and 18 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
data/ data/
comments.db/ comments.db/
notes notes
sass sass/node_modules

View File

@ -1,21 +1,30 @@
# TCP-WIKI # TCP-WIKI
[![Go Report Card](https://goreportcard.com/badge/github.com/vxfemboy/tcp-wiki)](https://goreportcard.com/report/github.com/vxfemboy/tcp-wiki)
Feel free to commit, leave suggestions/ideas, issues, or really anything <3 ![screenshot](examples/tcp-wiki.png "TCP-WIKI")
# What is TCP-WIKI ? ### What is TCP-WIKI ?
<center><img src="https://tcp.ac/i/TIZzK" alt="example screenshot" width="100" height="400"></center>
TCP.WIKI is a secure and verifiable wiki platform designed for projects, code, courses, documents, articles, blogs, tutorials, and more. TCP.WIKI is a secure, minimal, and verifiable wiki platform designed for projects, code, courses, documents, articles, blogs, tutorials, and more.
### Project Goals ### Project Goals
The aim is to provide a secure, minimal, and easily verifiable wiki environment that supports a wide range of content types, from technical documentation, to educational materials, to blogs, and more. The aim is to provide a secure, minimal, and easily verifiable wiki environment that supports a wide range of content types, from technical documentation, to educational materials, to blogs, and more.
#### Features:
* Full support for pages in Markdown and HTML
* Pull from GIT for live updates or usage of local directory
* No Javascript required
## Setup ## Setup
First clone this repository: First clone this repository:
```bash ```bash
git clone https://git.tcp.direct/S4D/tcp-wiki.git git clone https://github.com/vxfemboy/tcp-wiki.git
``` ```
Then you have to cd into the repo's folder and run/compile: Then you have to cd into the repo's folder and run/compile:
```bash ```bash
@ -31,12 +40,12 @@ All you have to do is modify the following lines in the `config.toml` file:
```toml ```toml
[Git] [Git]
UseGit = true # Set to false to use LocalPath UseGit = true # Set to false to use LocalPath
RepoURL = "https://git.tcp.direct/S4D/tcp-wiki.git" # Your Repo Here RepoURL = "https://github.com/vxfemboy/tcp-wiki.git" # Your Repo Here
Branch = "main" # Your Repo Branch Here Branch = "main" # Your Repo Branch Here
LocalPath = "data" # Directory to clone the git repo too LocalPath = "data" # Directory to clone the git repo too
``` ```
Change the `RepoURL` line `https://git.tcp.direct/S4D/tcp-wiki.git` to your repo link, Change the `RepoURL` line `https://github.com/vxfemboy/tcp-wiki.git` to your repo link,
change `main` to your specific repo's branch and you should be good to go! change `main` to your specific repo's branch and you should be good to go!
#### Want to use a local directory other then git repo? #### Want to use a local directory other then git repo?
@ -52,9 +61,23 @@ LocalPath = "/home/crazy/blog" # The directory of your project
``` ```
make sure to also set `LocalPath` to the directory of your project make sure to also set `LocalPath` to the directory of your project
> ### Want to use your own theme/layout? #### Want to use your own theme/layout?
>
> Have a look at the `assets/` directory for the templates Have a look at the `assets/` directory for the template `_layout.html` this is the main file that will be used
using [tailwindscss](https://tailwindcss.com/) and [daisyui](https://daisyui.com/) as a css library
to setup this for live modifications do:
```
cd sass
npm install
npx tailwindcss -i ./tail.css -o ../assets/main.css --watch
```
and to minify your css for production usage:
```
npx tailwindcss -o ../assets/main.css --minify
```
> ### ❤️ Feel free to commit, leave suggestions/ideas, issues, or really anything ❤️
## TODO ## TODO
@ -77,6 +100,6 @@ make sure to also set `LocalPath` to the directory of your project
- [ ] set security controls per page - [ ] set security controls per page
- [ ] auto refresh on post - [ ] auto refresh on post
- [x] dynamically generated links for all avaiable pages - [x] dynamically generated links for all avaiable pages
- [x] sitemap - kinda - [x] sitemap - kinda (needs limited)
- [x] working pages - [x] working pages
- [ ] image support - [x] image support

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@ Port = ":8080"
[Git] [Git]
UseGit = true UseGit = true
RepoURL = "https://git.tcp.direct/S4D/tcp-wiki.git" RepoURL = "https://github.com/vxfemboy/tcp-wiki.git"
Branch = "main" Branch = "main"
LocalPath = "data" LocalPath = "data"

45
examples/markdown.md Normal file
View File

@ -0,0 +1,45 @@
# MARKDOWN FORMATTING EXAMPLES
#### ASCII ART CODE BLOCK
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.;ll;. .,;.
.;dd;. ..,:. ':dx; ',. ..,:.
.cxo, .;;;:cll;. lodx: 'd. .;;;:cll;.
'. ,dxdx'odooxxl. .cxo. 'lxd, 'odooxxl.
xd; ... 'oxxx.. 'dkd. .lxc:dxxo:;,'. .. 'dkd.
oxd' .cxd, ,dxdo .lxx; 'oxxxdl;'..'ll. .lxx;
,dxl..cxxl. .cxd, ;xxl. ,dxo' .ck:. ;xxl.
.cxx,.lxxxc. ;xx, .oxd' ;dd' .lkc. .oxd'
,dxl..cxxl. .cxd, .lxx: ;xo. .ok: .lxx:
.cxx,.lxxxc. ;xx, ;xxl. .cxl. ,dx; ;xxl.
'dkl;oxxxx: :xo. 'dxd' ....'''dx; ;xd' 'dxd' ....''
.cxddxxccxd,.lkl. .cxxocloooddx :ko. ;xo. .cxxocloooddx
'dxxxd..lxocdx:......,:lc;,'...... ,xd, ;xl. ......,:lc;,'......
.cxxxc. ,dxxxd'xxdolc;'. 'oo' ,xo. xxdolc;'.
;xkd' .cxxxl ,''.. .. .ld'.,.,''..
.,;' 'dxxc 'oc.
cxxl .;.
.:l:
```

79
examples/pages/page-1.md Normal file
View File

@ -0,0 +1,79 @@
# MARKDOWN FORMATTING EXAMPLES
#### ASCII ART CODE BLOCK
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.;ll;. .,;.
.;dd;. ..,:. ':dx; ',. ..,:.
.cxo, .;;;:cll;. lodx: 'd. .;;;:cll;.
'. ,dxdx'odooxxl. .cxo. 'lxd, 'odooxxl.
xd; ... 'oxxx.. 'dkd. .lxc:dxxo:;,'. .. 'dkd.
oxd' .cxd, ,dxdo .lxx; 'oxxxdl;'..'ll. .lxx;
,dxl..cxxl. .cxd, ;xxl. ,dxo' .ck:. ;xxl.
.cxx,.lxxxc. ;xx, .oxd' ;dd' .lkc. .oxd'
,dxl..cxxl. .cxd, .lxx: ;xo. .ok: .lxx:
.cxx,.lxxxc. ;xx, ;xxl. .cxl. ,dx; ;xxl.
'dkl;oxxxx: :xo. 'dxd' ....'''dx; ;xd' 'dxd' ....''
.cxddxxccxd,.lkl. .cxxocloooddx :ko. ;xo. .cxxocloooddx
'dxxxd..lxocdx:......,:lc;,'...... ,xd, ;xl. ......,:lc;,'......
.cxxxc. ,dxxxd'xxdolc;'. 'oo' ,xo. xxdolc;'.
;xkd' .cxxxl ,''.. .. .ld'.,.,''..
.,;' 'dxxc 'oc.
cxxl .;.
.:l:
```
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.colclll;. .. :Oc. cKx. ..
.xNNkl:'. .:kx..dW0, .kNk. .:kx.
.kNx. .dk, .;dkx:. ;KWX: 'OWx. .dk, .;dkx:.
'ONo. :XNklxOxc. :OxxXl c0k' :XNklxOxc.
,xl. .. :XK: .;xNNKd:' 'dk:.;Xx. 'xOc. .;xNNKd:'
.lXx. .dXd..dNO. .,lxOxOXWd. .'. ,Kk,cOd. ...'' .,lxOxOXWd.
.dNl ,0WXx.'ONl .cxOOd:. ;KWd. '0XOd,...',:cllllclkXKd. cxOOd:. ;KWd.
'00':XKOXO,cX0, ;xo,. ;KWd. .cKN0dllllll:;'...'oKk; ;xo,. ;KWd.
dNloNd.oX0ldXd. ;XWd. .:x:.cxONk;.. .:00c. ;XWd. .:x:
:XOOXc cKKkKXc :XWd. ,d0kl' ;Xk. 'xXx. :XWd. ,d0kl'
.ONNK, ,ONNNK: :XWd.'ckOo' .OK, :KK: :XWd.'ckOo'
.dNWO. .oXNWO' :XWX00kc. dNc .oXO' :XWX00kc.
lNNo ;0NNd .;lOKOo;. :Xx. .xXx. .;lOKOo;.
:Kk. .dOl.;okOkd:. .l:. .kWXx .;okOkd:.
... . ;xo:'. ,oc;'. ;xo:'.
```

79
examples/pages/page-2.md Normal file
View File

@ -0,0 +1,79 @@
# MARKDOWN FORMATTING EXAMPLES
#### ASCII ART CODE BLOCK
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.;ll;. .,;.
.;dd;. ..,:. ':dx; ',. ..,:.
.cxo, .;;;:cll;. lodx: 'd. .;;;:cll;.
'. ,dxdx'odooxxl. .cxo. 'lxd, 'odooxxl.
xd; ... 'oxxx.. 'dkd. .lxc:dxxo:;,'. .. 'dkd.
oxd' .cxd, ,dxdo .lxx; 'oxxxdl;'..'ll. .lxx;
,dxl..cxxl. .cxd, ;xxl. ,dxo' .ck:. ;xxl.
.cxx,.lxxxc. ;xx, .oxd' ;dd' .lkc. .oxd'
,dxl..cxxl. .cxd, .lxx: ;xo. .ok: .lxx:
.cxx,.lxxxc. ;xx, ;xxl. .cxl. ,dx; ;xxl.
'dkl;oxxxx: :xo. 'dxd' ....'''dx; ;xd' 'dxd' ....''
.cxddxxccxd,.lkl. .cxxocloooddx :ko. ;xo. .cxxocloooddx
'dxxxd..lxocdx:......,:lc;,'...... ,xd, ;xl. ......,:lc;,'......
.cxxxc. ,dxxxd'xxdolc;'. 'oo' ,xo. xxdolc;'.
;xkd' .cxxxl ,''.. .. .ld'.,.,''..
.,;' 'dxxc 'oc.
cxxl .;.
.:l:
```
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.colclll;. .. :Oc. cKx. ..
.xNNkl:'. .:kx..dW0, .kNk. .:kx.
.kNx. .dk, .;dkx:. ;KWX: 'OWx. .dk, .;dkx:.
'ONo. :XNklxOxc. :OxxXl c0k' :XNklxOxc.
,xl. .. :XK: .;xNNKd:' 'dk:.;Xx. 'xOc. .;xNNKd:'
.lXx. .dXd..dNO. .,lxOxOXWd. .'. ,Kk,cOd. ...'' .,lxOxOXWd.
.dNl ,0WXx.'ONl .cxOOd:. ;KWd. '0XOd,...',:cllllclkXKd. cxOOd:. ;KWd.
'00':XKOXO,cX0, ;xo,. ;KWd. .cKN0dllllll:;'...'oKk; ;xo,. ;KWd.
dNloNd.oX0ldXd. ;XWd. .:x:.cxONk;.. .:00c. ;XWd. .:x:
:XOOXc cKKkKXc :XWd. ,d0kl' ;Xk. 'xXx. :XWd. ,d0kl'
.ONNK, ,ONNNK: :XWd.'ckOo' .OK, :KK: :XWd.'ckOo'
.dNWO. .oXNWO' :XWX00kc. dNc .oXO' :XWX00kc.
lNNo ;0NNd .;lOKOo;. :Xx. .xXx. .;lOKOo;.
:Kk. .dOl.;okOkd:. .l:. .kWXx .;okOkd:.
... . ;xo:'. ,oc;'. ;xo:'.
```

79
examples/pages/page-3.md Normal file
View File

@ -0,0 +1,79 @@
# MARKDOWN FORMATTING EXAMPLES
#### ASCII ART CODE BLOCK
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.;ll;. .,;.
.;dd;. ..,:. ':dx; ',. ..,:.
.cxo, .;;;:cll;. lodx: 'd. .;;;:cll;.
'. ,dxdx'odooxxl. .cxo. 'lxd, 'odooxxl.
xd; ... 'oxxx.. 'dkd. .lxc:dxxo:;,'. .. 'dkd.
oxd' .cxd, ,dxdo .lxx; 'oxxxdl;'..'ll. .lxx;
,dxl..cxxl. .cxd, ;xxl. ,dxo' .ck:. ;xxl.
.cxx,.lxxxc. ;xx, .oxd' ;dd' .lkc. .oxd'
,dxl..cxxl. .cxd, .lxx: ;xo. .ok: .lxx:
.cxx,.lxxxc. ;xx, ;xxl. .cxl. ,dx; ;xxl.
'dkl;oxxxx: :xo. 'dxd' ....'''dx; ;xd' 'dxd' ....''
.cxddxxccxd,.lkl. .cxxocloooddx :ko. ;xo. .cxxocloooddx
'dxxxd..lxocdx:......,:lc;,'...... ,xd, ;xl. ......,:lc;,'......
.cxxxc. ,dxxxd'xxdolc;'. 'oo' ,xo. xxdolc;'.
;xkd' .cxxxl ,''.. .. .ld'.,.,''..
.,;' 'dxxc 'oc.
cxxl .;.
.:l:
```
```
.'ckKo..'. ;dd;
.'codkXNk.'kKo. .,. ,ONXkc.
..;lodoc,.,kx'.dNWO. cKNO' .xNNNKkl;.
'c:'.',;cldOXOc'. . :XNNNd. ;KX0: .dNN0dkKKkl;.
cXNXOxdol;c0Wo .kW0dKNd'dWOc. .xWK; .;okKKxc'
,dkl. .OWo :XWo.,ONKKWk;. 'OWk. .:xXXx:.
,KN: oWX: .dNNWx'. '' :XNl .':ldkO0O:
:N0' .xW0' .lKKc. .kXd. .xNKdoooc;'...
dWx. .kWO. .. ;KNl .,codkXWx'
.kWo .OWO. '0Wd.lxkxl,..xWk.
.ONl .kW0' .oNX:,c,. cNK,
.kWo lNNl ,kX0: 'ONl
cNO. .xNKc. ..'cxKOc. .kNl
.c0c .cOKOxooodddddc' .,.
.' .,,;,,...
.colclll;. .. :Oc. cKx. ..
.xNNkl:'. .:kx..dW0, .kNk. .:kx.
.kNx. .dk, .;dkx:. ;KWX: 'OWx. .dk, .;dkx:.
'ONo. :XNklxOxc. :OxxXl c0k' :XNklxOxc.
,xl. .. :XK: .;xNNKd:' 'dk:.;Xx. 'xOc. .;xNNKd:'
.lXx. .dXd..dNO. .,lxOxOXWd. .'. ,Kk,cOd. ...'' .,lxOxOXWd.
.dNl ,0WXx.'ONl .cxOOd:. ;KWd. '0XOd,...',:cllllclkXKd. cxOOd:. ;KWd.
'00':XKOXO,cX0, ;xo,. ;KWd. .cKN0dllllll:;'...'oKk; ;xo,. ;KWd.
dNloNd.oX0ldXd. ;XWd. .:x:.cxONk;.. .:00c. ;XWd. .:x:
:XOOXc cKKkKXc :XWd. ,d0kl' ;Xk. 'xXx. :XWd. ,d0kl'
.ONNK, ,ONNNK: :XWd.'ckOo' .OK, :KK: :XWd.'ckOo'
.dNWO. .oXNWO' :XWX00kc. dNc .oXO' :XWX00kc.
lNNo ;0NNd .;lOKOo;. :Xx. .xXx. .;lOKOo;.
:Kk. .dOl.;okOkd:. .l:. .kWXx .;okOkd:.
... . ;xo:'. ,oc;'. ;xo:'.
```

BIN
examples/tcp-wiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

2
go.mod
View File

@ -19,6 +19,7 @@ require (
github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@ -29,6 +30,7 @@ require (
github.com/plar/go-adaptive-radix-tree v1.0.4 // indirect github.com/plar/go-adaptive-radix-tree v1.0.4 // indirect
github.com/sergi/go-diff v1.3.1 // indirect github.com/sergi/go-diff v1.3.1 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect github.com/skeema/knownhosts v1.2.1 // indirect
github.com/tenkoh/goldmark-img64 v0.1.1 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.17.0 // indirect golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20200228211341-fcea875c7e85 // indirect golang.org/x/exp v0.0.0-20200228211341-fcea875c7e85 // indirect

4
go.sum
View File

@ -65,6 +65,8 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@ -231,6 +233,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tenkoh/goldmark-img64 v0.1.1 h1:JHTqUuvCZYzXbu+QouNk+c/w8qpZ3sAj+qFgr3pWXGg=
github.com/tenkoh/goldmark-img64 v0.1.1/go.mod h1:m3Z5ytQWSf1Lcdv2cXWXSRB7epGz5ka7kUeXTDSgDwk=
github.com/tidwall/btree v0.2.2/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8= github.com/tidwall/btree v0.2.2/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/redcon v1.4.0/go.mod h1:IGzxyoKE3Ea5AWIXo/ZHP+hzY8sWXaMKr7KlFgcWSZU= github.com/tidwall/redcon v1.4.0/go.mod h1:IGzxyoKE3Ea5AWIXo/ZHP+hzY8sWXaMKr7KlFgcWSZU=

3007
sass/main.css Normal file

File diff suppressed because it is too large Load Diff

1465
sass/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

7
sass/package.json Normal file
View File

@ -0,0 +1,7 @@
{
"devDependencies": {
"@tailwindcss/typography": "^0.5.10",
"daisyui": "^4.7.2",
"tailwindcss": "^3.4.1"
}
}

4
sass/tail.css Normal file
View File

@ -0,0 +1,4 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwindcss/typography;

12
sass/tailwind.config.js Normal file
View File

@ -0,0 +1,12 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["../assets/**/*.{html,js}"],
theme: {
extend: {},
},
daisyui: {
themes: ["forest"]
},
plugins: [require("@tailwindcss/typography"), require("daisyui")],
}

View File

@ -114,7 +114,7 @@ func handler(config *Config, w http.ResponseWriter, r *http.Request) {
log.Printf("Rendering file %q from path %q", filePath, r.URL.Path) log.Printf("Rendering file %q from path %q", filePath, r.URL.Path)
// Set the Content Security Policy // Set the Content Security Policy
csp := "default-src 'self'; img-src 'self'; script-src 'self'; style-src 'self';" csp := "default-src 'self'; font-src 'self' data:; frame-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self';"
w.Header().Set("Content-Security-Policy", csp) w.Header().Set("Content-Security-Policy", csp)
markdownFiles, err := listMarkdownFiles(config.Git.LocalPath) markdownFiles, err := listMarkdownFiles(config.Git.LocalPath)

View File

@ -14,6 +14,9 @@ import (
"github.com/yuin/goldmark" "github.com/yuin/goldmark"
highlighting "github.com/yuin/goldmark-highlighting" highlighting "github.com/yuin/goldmark-highlighting"
"github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
img64 "github.com/tenkoh/goldmark-img64"
) )
type Page struct { type Page struct {
@ -61,11 +64,21 @@ func renderMarkdown(w http.ResponseWriter, r *http.Request, content []byte, comm
md := goldmark.New( md := goldmark.New(
goldmark.WithExtensions( goldmark.WithExtensions(
extension.GFM, extension.GFM, // images should probably be base64 encoded https://github.com/tenkoh/goldmark-img64 for extra performance
extension.Table,
highlighting.NewHighlighting( highlighting.NewHighlighting(
highlighting.WithStyle("monokai"), highlighting.WithStyle("monokai"),
), ),
), img64.Img64,
), // does this code below do anything useful?
goldmark.WithParserOptions(
parser.WithAutoHeadingID(),
),
goldmark.WithRendererOptions(
html.WithXHTML(),
html.WithHardWraps(),
img64.WithParentPath(config.Git.LocalPath),
),
) )
var author, lastModifier string var author, lastModifier string