Added support for v2 Confluence page format (#29)

* Added support for v2 pge format

* Added toc macro

* Added toc to documentation

Co-authored-by: Stefano Teodorani <teopost@sviluppo06.apex-net.it>
This commit is contained in:
Stefano Teodorani 2020-10-19 16:46:52 +02:00 committed by GitHub
parent e26903dcee
commit eda2e4704d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View File

@ -156,7 +156,13 @@ This is my article.
* :todo: Publish Article * :todo: Publish Article
``` ```
## Insert Jira Ticket ### Insert Table of Contents
```markdown
<!-- Include: ac:toc -->
```
### Insert Jira Ticket
**article.md** **article.md**

View File

@ -385,6 +385,13 @@ func (api *API) CreatePage(
"value": body, "value": body,
}, },
}, },
"metadata": map[string]interface{}{
"properties": map[string]interface{}{
"editor": map[string]interface{}{
"value": "v2",
},
},
},
} }
if parent != nil { if parent != nil {

View File

@ -136,6 +136,19 @@ func templates(api *confluence.API) (*template.Template, error) {
`</ac:structured-macro>`, `</ac:structured-macro>`,
), ),
/* https://confluence.atlassian.com/conf59/table-of-contents-macro-792499210.html */
`ac:toc`: text(
`<ac:structured-macro ac:name="toc">`,
`<ac:parameter ac:name="printable">true</ac:parameter>`,
`<ac:parameter ac:name="style">disc</ac:parameter>`,
`<ac:parameter ac:name="maxLevel">7</ac:parameter>`,
`<ac:parameter ac:name="minLevel">1</ac:parameter>`,
`<ac:parameter ac:name="exclude">{{ .Exclude }}</ac:parameter>`,
`<ac:parameter ac:name="outline">false</ac:parameter>`,
`</ac:structured-macro>`,
),
// TODO(seletskiy): more templates here // TODO(seletskiy): more templates here
} { } {
templates, err = templates.New(name).Parse(body) templates, err = templates.New(name).Parse(body)