diff --git a/README.md b/README.md index ecefa6f..d63c032 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,29 @@ This is my article. ``` +If default TOC looks don't find a way to your heart, try [parametrizing it][Confluence TOC Macro], for example: + +```markdown + + +# This is my nice title + +:toc: +``` + +You can call the `Macro` as you like but the `Template` field must have the `ac:toc` value. +Also, note the single quotes around `'false'`. + +See [Confluence TOC Macro] for the list of parameters - keep in mind that here +they start with capital letters. Every skipped field will have the default +value, so feel free to include only the ones that you require. + + +[Confluence TOC Macro]:https://confluence.atlassian.com/conf59/table-of-contents-macro-792499210.html + ### Insert Jira Ticket **article.md** diff --git a/pkg/mark/stdlib/stdlib.go b/pkg/mark/stdlib/stdlib.go index 1644ce0..4355030 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -139,14 +139,17 @@ func templates(api *confluence.API) (*template.Template, error) { /* https://confluence.atlassian.com/conf59/table-of-contents-macro-792499210.html */ `ac:toc`: text( - ``, - `true`, - `disc`, - `7`, - `1`, - `{{ .Exclude }}`, - `false`, - ``, + `{{printf "\n"}}`, + `{{ or .Printable "true" }}{{printf "\n"}}`, + `{{ or .Style "disc" }}{{printf "\n"}}`, + `{{ or .MaxLevel "7" }}{{printf "\n"}}`, + `{{ or .Indent "" }}{{printf "\n"}}`, + `{{ or .MinLevel "1" }}{{printf "\n"}}`, + `{{ or .Exclude "" }}{{printf "\n"}}`, + `{{ or .Type "list" }}{{printf "\n"}}`, + `{{ or .Outline "clear" }}{{printf "\n"}}`, + `{{ or .Include "" }}{{printf "\n"}}`, + `{{printf "\n"}}`, ), // TODO(seletskiy): more templates here