Description
ciigo is a library and a program to write static web server with embedded files using asciidoc markup.
ciiigo alternatives and similar packages
Based on the "Go Tools" category.
Alternatively, view ciigo alternatives based on common mentions on social networks and blogs.
-
JuiceFS
JuiceFS is a distributed POSIX file system built on top of Redis and S3. -
JSON-to-Go
Translates JSON into a Go type in your browser instantly (original) -
The Go Play Space
Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more -
Peanut
🐺 Deploy Databases and Services Easily for Development and Testing Pipelines. -
golang-tutorials
Golang Tutorials. Learn Golang from Scratch with simple examples. -
xdg-go
Go implementation of the XDG Base Directory Specification and XDG user directories -
typex
[TOOL, CLI] - Filter and examine Go type structures, interfaces and their transitive dependencies and relationships. Export structural types as TypeScript value object or bare type representations. -
gothanks
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself. -
go-lock
go-lock is a lock library implementing read-write mutex and read-write trylock without starvation -
Viney's go-cache
A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern. -
goroutines
It is an efficient, flexible, and lightweight goroutine pool. It provides an easy way to deal with concurrent tasks with limited resource. -
An exit strategy for go routines.
An exit strategy for go routines -
generator-go-lang
A Yeoman generator to get new Go projects started. -
go-james
James is your butler and helps you to create, build, debug, test and run your Go projects -
import "github/shuLhan/share"
A collection of libraries and tools written in Go; including DNS, email, git ini file format, HTTP, memfs (embedding file into Go), paseto, SMTP, TOTP, WebSocket, XMLRPC, and many more. -
PDF to Image Converter Using Golang
This project will help you to convert PDF file to IMAGE using golang. -
go-sanitize
:bathtub: Golang library of simple to use sanitation functions -
go-whatsonchain
:link: Unofficial golang implementation for the WhatsOnChain API -
gomodrun
The forgotten go tool that executes and caches binaries included in go.mod files. -
Proofable
General purpose proving framework for certifying digital assets to public blockchains -
docs
Automatically generate RESTful API documentation for GO projects - aligned with Open API Specification standard -
MessageBus implementation for CQRS projects
CQRS Implementation for Golang language -
redispubsub
Redis Streams queue driver for https://godoc.org/gocloud.dev/pubsub package -
go-slices
Helper functions for the manipulation of slices of all types in Go -
modver
Compare two versions of a Go module to check the version-number change required (major, minor, or patchlevel), according to semver rules. -
channelize
A websocket framework to manage outbound streams. Allowing to have multiple channels per connection that includes public and private channels. -
go-pipl
:family_man_woman_boy: Unofficial golang implementation for the pipl.com search API -
num30/go-cache
An in-memory key:value store/cache (similar to Memcached) library that takes advantage of Go Generics
Build time-series-based applications quickly and at scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of ciiigo or a related project?
README
Welcome to ciigo
ciigo
is a library and a program to write static web server with embedded
files using
asciidoc
markup format.
ciigo as CLI
ciigo as CLI can convert, generate, and/or serve a directory that contains markup files, as HTML files.
Usage
$ ciigo [-template <file>] [-exclude <regex>] convert <dir>
Scan the "dir" recursively to find markup files (.adoc) and convert them into HTML files. The template "file" is optional, default to embedded HTML template.
$ ciigo [-template <file>] [-exclude <regex>] [-out <file>] generate <dir>
Convert all markup files inside directory "dir" recursively and then embed them into ".go" source file. The output file is optional, default to "ciigo_static.go" in current directory.
$ ciigo [-template <file>] [-exclude <regex>] [-address <ip:port>] serve <dir>
Serve all files inside directory "dir" using HTTP server, watch changes on markup files and convert them to HTML files automatically. If the address is not set, its default to ":8080".
ciigo as library
This section describe step by step instructions on how to build and create
pages to be viewed for local development using ciigo
.
First, clone the ciigo
repository.
Let says that we have cloned the ciigo
repository into
$HOME/go/src/git.sr.ht/~shulhan/ciigo
.
Create new Go repository for building a website.
For example, in directory $HOME/go/src/remote.tld/user/mysite
.
Replace "remote.tld/user/mysite" with your private or public repository.
$ mkdir -p $HOME/go/src/remote.tld/user/mysite
$ cd $HOME/go/src/remote.tld/user/mysite
Initialize the Go module,
$ go mod init remote.tld/user/mysite
Create directories for storing our content and a package binary.
$ mkdir -p cmd/mysite
$ mkdir -p _contents
Copy the example of stylesheet and HTML template from ciigo
repository,
$ cp $HOME/go/src/git.sr.ht/~shulhan/ciigo/_example/index.css ./_contents/
$ cp $HOME/go/src/git.sr.ht/~shulhan/ciigo/_example/html.tmpl ./_contents/
Create the main Go code inside cmd/mysite
,
package main
import (
"git.sr.ht/~shulhan/ciigo"
"github.com/shuLhan/share/lib/memfs"
)
var mysiteFS *memfs.MemFS
func main() {
opts := &ciigo.ServeOptions{
ConvertOptions: ciigo.ConvertOptions{
Root: "_contents",
HtmlTemplate: "_contents/html.tmpl",
},
Address: ":8080",
Mfs: mysiteFS,
}
err := ciigo.Serve(opts)
if err != nil {
log.Fatal(err)
}
}
Create a new markup file index.adoc
inside the "_contents" directory.
Each directory, or sub directory, should have index.adoc
to be able to
accessed by browser,
= Test
Hello, world!
Now run the ./cmd/mysite
with DEBUG
environment variable set to non-zero,
$ DEBUG=1 go run ./cmd/mysite
Any non zero value on DEBUG
environment signal the running program to watch
changes in ".adoc" files inside "_contents" directory and serve the generated
HTML directly.
Open the web browser at localhost:8080
to view the generated HTML.
You should see "Hello, world!" as the main page.
Thats it!
Create or update any ".adoc" files inside "_contents" directory, the program will automatically generated the HTML file. Refresh the web browser to load the new generated file.
Deployment
First, we need to make sure that all markup files inside "_contents" are converted to HTML and embed it into the static Go code.
Create another Go source code, lets save it in internal/generate.go
with the
following content,
package main
import (
"git.sr.ht/~shulhan/ciigo"
)
func main() {
opts := &ciigo.EmbedOptions{
ConvertOptions: ciigo.ConvertOptions{
Root: "./_contents",
HtmlTemplate: "_contents/html.tmpl",
},
EmbedOptions: memfs.EmbedOptions{
PackageName: "main",
VarName: "mysiteFS",
GoFileName: "cmd/mysite/static.go",
},
}
ciigo.GoEmbed(opts)
}
And then run,
$ go run ./internal
The above command will generate Go source code cmd/mysite/static.go
that
embed all files inside the "_contents" directory.
Second, build the web server that serve static contents in static.go
,
$ go build cmd/mysite
Third, test the web server by running the program and opening localhost:8080
on web browser,
$ ./mysite
Finally, deploy the program to your server.
NOTE: By default, server will listen on address 0.0.0.0
at port 8080
.
If you need to use another port, you can change it at cmd/mysite/main.go
.
That's it!
Limitations and Known Bugs
ciigo
will not handle automatic certificate (e.g. using LetsEncrypt), its
up to the user how the certificate are gathered, generated, or served.
Using symlink on ".adoc" file inside Root directory that reference file outside of Root is not supported, yet.