aboutsummaryrefslogtreecommitdiff
path: root/ciigo.go
AgeCommit message (Collapse)Author
2026-02-11cmd/ciigo: add option to set base path and shutdown idle durationShulhan
The `-base-path` option set the URL prefix for serving HTTP request. This allow serving the content under the prefix other than "/". The `-shutdown-idle` option set the duration when server will stop accepting new connections and shutting down. This option can be helpful to reduce the resources on local environment.
2026-02-07all: embed struct [lib/http.ServerOptions] directly to [ServeOptions]Shulhan
At this point, all of the fields in the struct ServeOptions is the same with [lib/http.ServerOptions] except IsDevelopment and ConvertOptions. For field IsDevelopment we keep in the struct. For field ConvertOptions we remove it and let the caller pass it on Serve function or InitHTTPServer method.
2026-01-24all: embed CSS and index HTML template using memfsShulhan
Previously, with direct embed, every time we change the CSS or index template, we need to restart the "ciigo serve" command. Using memfs make us easy to update and see the changes directly, without restarting the server.
2026-01-16go.mod: update pakakeh.go to v0.60.3-0.20260115103415-806359d5462fShulhan
This update have changes on [lib/http.FSHandler] that return second parameter, status code.
2025-12-27Release ciigo v0.15.3 (2025-12-27)v0.15.3Shulhan
This is the last release for year 2025. In the README, we fix broken "Change log" link when rendered on pkg.go.dev and sr.ht sites. The go.mod has been updated to use minimum Go 1.24.0; and all dependencies has been updated to latest release. Happy holidays!
2025-04-18Release ciigo v0.15.2 (2025-04-18)v0.15.2Shulhan
This release update the core asciidoctor-go module that brings several new features. [NEW FEATURE] **Support include directive inside block code.** Example of block code with include directive, ---- ... include::file[] ... ---- [NEW FEATURE] **Support document attribute "docdir".** The "docdir" attribute contains the full path of the directory that contains the source document. By default it is set to the directory where the Document resided. [NEW FEATURE] **Add default HTML stylesheet**. The generated HTML now contains the default stylesheet. The stylesheet is copied from HTML file generated by Asciidoctor v2.0.23.
2025-02-01Release ciigo v0.15.1 (2025-02-01)v0.15.1Shulhan
[BUG FIX] Fix section detected as paragraph after list and comment. Previously, given the following markup, ---- * Sub list + Sub list content. //}}} //{{{ == Sub 2 //}} ---- The section "Sub 2" will be parsed as paragraph instead of new section. [CHORE] In the linter, we replace the fieldalignment and shadow using our internal gocheck command. This linters actually have an API that can be combined into a program, which provided by package "pakakeh.go/lib/goanalysis".
2025-01-08Release ciigo v0.15.0 (2025-01-08)v0.15.0Shulhan
This is the first major release of ciigo on the new year of 2025. We bring many enhancements and update on the documentation. [ENHANCEMENT] The first changes is refactoring to use watchfs/v2. The [watchfs/v2] bring new enhancements by watching only single file instead of all markup files for changes. This minimize number of goroutine calling [os.Stat] on each markup files. [BUG FIX] When listing the file markups, if the node is symlink (either file or directory) and target its not exist, continue to the next node instead of returning error. The same is true for directory that cannot be opened, probably due to broken symlink or permission. [ENHANCEMENT] In development mode, where [ServeOptions.IsDevelopment] is set to true or when running "ciigo serve", the ciigo HTTP server will check if the new markup file is newer than HTML file when user press refresh or reload on the browser. If its newer, it will convert the markup file and return the new content of HTML file. This allow quick preview without waiting for watcher to complete. [ENHANCEMENT] The README has been revamped to include section on how to install ciigo as program, how to running ciigo convert and serve, how to write content and view it live on browser, and how to deploy it. On the section "ciigo as library" we point the user the sample code at "internal/cmd/ciigo-example" instead of writing long code at the front. [BUG FIX] This release also fix Exclude option does not get processed when calling GoEmbed, or running "ciigo embed".
2025-01-07all: fix GoEmbed that does not excludes options from ConvertOptionsShulhan
2025-01-07all: ignore error when scanning for file markupsShulhan
When listing the file markups, if the node is symlink (either file or directory) and target its not exist, continue to the next node instead of returning error. The same is true for directory that cannot be opened, probably due to broken symlink or permission.
2024-10-06Release ciigo v0.14.0 (2024-10-06)v0.14.0Shulhan
=== Breaking changes * all: refactoring functions to accept non pointer struct option The function that accept struct XxxOptions should only received the copy of struct, not pointer. === New features * all: introduce new type Ciigo The Ciigo type provides customizable and reusable instance of ciigo for embedding, converting, and/or serving HTTP server. This type is introduced so one can add HTTP handler or endpoint along with serving the files. === Enhancements * all: set margin on sectlevel3, sectlevel4, sectlevel5 Using default margin (1.25rem) cause the TOC for level 3 until 5 have wide gap in between them.
2024-10-06all: refactoring functions to accept non pointer struct optionShulhan
The function that accept struct XxxOptions should only received the copy of struct, not pointer.
2024-09-28all: introduce new type CiigoShulhan
The Ciigo type provides customizable and reusable instance of ciigo for embedding, converting, and/or serving HTTP server. This type is introduced so one can add HTTP handler or endpoint along with serving the files.
2024-09-07Release ciigo v0.13.2 (2024-09-07)v0.13.2Shulhan
Update on asciidoctor-go bring new features and enhancements, * Support document attribute "leveloffset". The ":leveloffset:" on document attribute allow increment or decrement the heading level on included files. Reference: https://docs.asciidoctor.org/asciidoc/latest/directives/include-with-leveloffset/ * Use strict document header format. Previously, an empty line before Document Title cause the parser stop parsing the document header, now an empty lines are skipped. Also document attribute can be place anywhere, either before or after title, and in between attributes; now it can be only placed after revision or author or title.
2024-08-04Release ciigo v0.13.1 (2024-08-04)v0.13.1Shulhan
=== Bug fixes * Fix "serve" not detecting new files:: If there is new files on the root of directory it will not detected automatically. This release now fix this issue. === Others * all: remove Limitations and update Links The asciidoc-go library now support scanning symlink inside Root directory. The Links sections merge the previous contents from old index.adoc. * all: update the CLI usage in the README There are three places for command usage: one in main Go doc, one in the program usage, and one in README. If we changes the flags we need to update three of them, and sometimes we forgot. To simplify, we remove the one in the Go doc main program.
2024-05-12Release ciigo v0.13.0 (2024-05-12)v0.13.0Shulhan
=== New features * cmd/ciigo: add flag to set package and variable name for "embed" The flag "-package-name" can be used to changes the default package name inside the Go embed file. The flag "-var-name" can be used to changes the default memfs variable name inside the Go embed file. === Enhancements * all: fix HTML files always generated when HTMLTemplate is not set If the path to HTMLTemplate option is not set, GoEmbed should convert to HTML only if markup file is newer than HTML file or when HTML file not exist. * all: initialize memfs using New When memfs not initialized using New, the [memfs.MemFS.PathNodes] will be nil. This cause any Get on new file will return 404.
2024-04-11all: fix HTML files always generated when HTMLTemplate is not setShulhan
If the path to HTMLTemplate option is not set, GoEmbed should convert to HTML only if markup file is newer than HTML file or when HTML file not exist.
2024-04-04Release ciigo v0.12.0 (2024-04-04)v0.12.0Shulhan
=== New features * all: add server option to automatically generate index HTML If the requested path is directory and no "index.html" file exist in that directory, ciigo server will render list of files as "index.html" automatically. === Chores * all: replace module "share" with "pakakeh.go" The "share" module has been moved to new repository with new name at "https://sr.ht/~shulhan/pakakeh.go".
2024-03-05all: replace module "share" with "pakakeh.go"Shulhan
2023-12-14Release ciigo v0.11.0 (2023-12-14)v0.11.0Shulhan
=== Breaking changes * Field [ConvertOptions.HtmlTemplate] become [ConvertOptions.HTMLTemplate] * Method [Converter.SetHtmlTemplateFile] become [Converter.SetHTMLTemplateFile] * Method [Converter.ToHtmlFile] become [Converter.ToHTMLFile] === Bug fix * asciidoc: fix custom ID on the first section not applied correctly
2023-12-10all: fix all warnings reported by linter reviveShulhan
Unfortunately, this breaks some API and exported fields, but its better than creating revive.toml file to add an exception. Some breaking changes, * Field [ConvertOptions.HtmlTemplate] become [ConvertOptions.HTMLTemplate] * Method [Converter.SetHtmlTemplateFile] become [Converter.SetHTMLTemplateFile] * Method [Converter.ToHtmlFile] become [Converter.ToHTMLFile]
2023-11-09Release ciigo v0.10.1 (2023-11-07)v0.10.1Shulhan
In this release, update on asciidoctor-go add new features to parse unordered list with '-' and some bug fixes related to rendering list. The update on share module fix for permission error when scanning using memfs and HTTP redirect for request to directory that does not end with slash. === Bug fixes all: ignore error permission when listing file markups:: Instead of returning the error, ignore it and continue processing other files in the list. === Enhancements all: print log message with log package:: This is to provide the timestamp to each log output. cmd/ciigo: set default IP address to loopback on serve command:: Previously, the default IP address is 0.0.0.0 which listen on all network interfaces. Listening to all network interface should be explicit by user. all: use modification time to force HTML conversion:: In this changes, we derive the decision based on modification time of HTML template and markup file. If the HTML template or markup file is newer that HTML file then the new HTML file will be generated.
2023-11-09all: use modification time when deciding when to convert to HTMLShulhan
Previously, in changes 46bd8b68dc8c we pass the force=true to Convert function. In this changes, we derive the decision based on modification time of HTML template and markup file. If the HTML template or markup file is newer that HTML file then the new HTML file will be generated.
2023-11-07all: add comment to exported variable VersionShulhan
2023-10-14all: make "convert" to always forceShulhan
Previously, the convert command only check if the markup file is newer than the output file. If the template file updated, it will not re-convert the markup file. This changes fix this by always convert the markup files regarding their output modification times.
2023-06-01all: ignore error permission when listing file markupsShulhan
Instead of returning the error, ignore it and continue processing other files in the list.
2023-05-14Release ciigo v0.10.0 (2023-05-14)v0.10.0Shulhan
=== New features * all: bring back support for Markdown I use two remote repositories: GitHub and SourceHut. GitHub support rendering README using asciidoc while SourceHut not. This cause the repository that use README.adoc rendered as text in SourceHut which make the repository page less readable. Also, the pkg.go.dev now render README but only support Markdown. Since we cannot control the SourceHut and go.dev, the only option is to support converting Markdown in ciigo so I can write README using Markdown and the rest of documentation using Asciidoc.
2023-05-14all: bring back support for MarkdownShulhan
I use two remote repositories: GitHub and SourceHut. GitHub support rendering README using asciidoc while SourceHut not. This cause the repository that use README.adoc rendered as text in SourceHut which make the repository page less readable. Also, the pkg.go.dev now render README but only support Markdown. Since we cannot control the SourceHut and go.dev, the only option is to support converting Markdown in ciigo so I can write README using Markdown and the rest of documentation using Asciidoc.
2023-03-03Release ciigo v0.9.3 (2022-03-03)v0.9.3Shulhan
Changes on the asciidoctor-go v0.4.1, === Bug fixes * all: fix empty line printed on ToHTMLBody or ToHTMLEmbedded * all: ignore parsing block image in paragraph === Enhancements * all: handle empty preamble
2022-09-06Release ciigo v0.9.2 (2022-09-06)v0.9.2Shulhan
=== Bug fix * all: check for symlink and re-fetch file info using os.Stat === Chores * all: update all dependencies * all: group all documents under directory _doc * all: try to fix test that sometimes fail inside container * all: add tasks to setup test inside systemd container
2022-09-06all: check for symlink and re-fetch file info using os.StatShulhan
Since Readdir return list of FileInfo using Lstat, any node that is symlink may return false file size and mod time.
2022-08-07Release ciigo v0.9.1 (2022-08-07)v0.9.1Shulhan
=== Bug fixes * all: remove delay for testing Watch. The delay sometimes cause the test locked and hung. * all: fix HTML template loaded during Serve on non-development The HTML template in the ServeOptions should not read when ciigo.Serve running on non-development environment.
2022-08-06Release ciigo v0.9.0 (2022-08-06)v0.9.0Shulhan
=== New features * all: export internal htmlGenerator as Converter === Chores * all: add package build for Arch Linux * all: set the Version automatically set during build * all: convert the README using AsciiDoc * all: merge internal/cmd/goembed to cmd/ciigo-example
2022-08-06all: set the Version automatically set during buildShulhan
This require that the command build or install using "make build/install".
2022-08-06all: cleaning up codesShulhan
2022-08-01all: clean up codesShulhan
Replace any usage of ":=" with explicit variable declaration for better types clarity.
2022-08-01all: export internal htmlGenerator as ConverterShulhan
The purpose of Converter is to provide a single, reusable converter for AsciiDoc file or content.
2022-07-24all: generate HTML meta data and replace the top header titleShulhan
The following metadata are rendered based on the same asciidoc attributes: author, description, generator, and keywords. This changes also replace the topbar title with the document title, cleanup the HTML header syntax by replacing "/>" with ">", trim leading and trailing spaces on Body and embedded CSS.
2022-05-19all: reformat all files using latest goimportsShulhan
While at it, replace any use of ioutil with os/io package.
2022-03-12all: check for excluded file before processing sub directoryShulhan
Previously, if the file path match with one of the excluded pattern, we keep processing the sub directory to find the markup files. This may cause an error "too many open files" if excluded directory contains many sub directory and/or files. This changes fix this issue by checking the path with excluded pattern first before diving into sub directory.
2022-03-04all: re-convert markup files if HTML template is newer on GoEmbedShulhan
Calling GoEmbed with updated HTML template will reconvert all markup files automatically, as long as the generated Go file is older than the HTML template file.
2022-03-04all: re-licensing ciigo under GPL-3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2022-02-19all: fix adoc files not re-converted when template file changesShulhan
In commit 06d03f6afe37 we skip converting files if the generated HTML is newer than adoc file. This cause an issue where the template file changes during Watch or Serve, but the HTML files is not regenerated.
2021-12-20go.mod: update to latest share moduleShulhan
2021-10-27all: update to latest share moduleShulhan
The latest share module simplify the memfs.GoEmbed call by using struct memfs.EmbedOptions instead of passing it as parameters. The changes on share module affect on how EmbedOptions in this module, where memfs.EmbedOptions is used to replace field PackageName, VarName, and GoFileName.
2021-10-17all: fix empty fileMarkups on watcherShulhan
Previously, when user call ciigo.Watch(), and the markup file changes, the onChangeFileMarkup method will print an error "xyz not found" which cause the markup file not converted. This is caused by watcher.fileMarkups is empty. This changes fix this issue by initializing the fileMarkups field using listFileMarkups, so the next callback to onChangeFileMarkup can detect the changed file and convert it.
2021-10-10all: check markup modification time before converting to HTMLShulhan
Previously, when the Convert, Watch or Serve running it will convert all markup files into HTML without checking if the adoc has been modified or newer than HTML file. This changes check the modification time of markup file first before converting them, to minimize unnecessary operation.
2021-10-10all: refactoring with latest share moduleShulhan
The lates share module use the term GoEmbed to generate Go source file. In order for this repo in sync with upstream terminology and to minimize confusion, we changes the exported function and command name from "generate" to "embed", this includes * Command "ciigo generate" become "ciigo embed" * Exported function to generate Go renamed from "Generate" to "GoEmbed". This include the parameter GenerateOptions which renamed to EmbedOptions. * The internal command to generate example renamed from "generate" to "goembed"
2021-04-07all: replace any mention of asciidoc with markupShulhan
2021-04-03all: add option to exclude certain paths using regular expressionShulhan
The ConvertOptions now has the Exclude field that can contains regular expression. If the Exclude is not empty, it will be compiled and use in Convert, Generate, Watch, and Serve; to ignore specific paths being scanned.