forked from startnext/terraform-provider-wikijs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tyclipso/rendering-api
Add data_source and resource for rendering api of wikijs
- Loading branch information
Showing
15 changed files
with
1,294 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wikijs_renderers Data Source - terraform-provider-wikijs" | ||
subcategory: "" | ||
description: |- | ||
The wikijs_renderers Data Source implements the WikiJS API query rendering{renderers{…}}. | ||
You can use this data source to manipulate only certain fields with the renderers resource. | ||
--- | ||
|
||
# wikijs_renderers (Data Source) | ||
|
||
The `wikijs_renderers` Data Source implements the WikiJS API query `rendering{renderers{…}}`. | ||
You can use this data source to manipulate only certain fields with the `renderers` resource. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# Use this data source to query the current setup and make changes in | ||
# certain renderers. Note that this data source only takes an empty | ||
# renderers list. | ||
data "wikijs_theme_renderers" "renderers" { | ||
renderers = [] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `renderers` (Attributes List) List of renderers in the system. (see [below for nested schema](#nestedatt--renderers)) | ||
|
||
<a id="nestedatt--renderers"></a> | ||
### Nested Schema for `renderers` | ||
|
||
Read-Only: | ||
|
||
- `config` (Map of String) A list of Key/Value pairs of config for each renderer. | ||
Some take none, others have a long list. | ||
You can use this field in the `renderers` ressource. | ||
- `depends_on` (String) The `key` of the renderer, this renderer depends on. | ||
This could be `markdownCore` for a markdown renderer. | ||
The `renderers` ressource currently does not check against this, so make sure to activate them. | ||
- `description` (String) The description of the renderer shown in the backend. | ||
- `icon` (String) The icon of the renderer shown in the backend. | ||
- `input` (String) What kind of input format this renderer takes. | ||
This could be for example `markdown`, `asciidoc`, `openapi`, `html` or `null`. | ||
- `is_enabled` (Boolean) Either if the renderer is active or not. | ||
You can use this field in the `renderers` ressource. | ||
- `key` (String) The unique identifier of each renderer. | ||
This is set in code and you can use this field in the `renderers` ressource. | ||
- `output` (String) What kind of output format this renderer produces. | ||
This could be for example `html` or `null`. | ||
- `title` (String) The title of the renderer shown in the backend. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,277 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wikijs_renderers Resource - terraform-provider-wikijs" | ||
subcategory: "" | ||
description: |- | ||
The wikijs_renderers Resource implements the WikiJS API mutatation rendering{updateRenderers{renderers{…}}}. | ||
Be aware. | ||
This Resource supports only one instance as the implementation needs the complete configuration of renderers. | ||
You cannot specify one renderer with its config as this will erase the complete list. | ||
If you are unsure about the key and config fields, you can query the API after activating it manually or with the wikijs_api resource. | ||
The query with the minimal information you need is as follows: | ||
graphql | ||
query{ | ||
rendering{ | ||
renderers{ | ||
title, | ||
key, | ||
isEnabled, | ||
config{ | ||
key, | ||
value | ||
} | ||
} | ||
} | ||
} | ||
The title field is not needed in the wikijs_renderers Resource but is necessary for the graphql query. | ||
You get back a JSON in the config.value field where you have to look for another value field. | ||
--- | ||
|
||
# wikijs_renderers (Resource) | ||
|
||
The `wikijs_renderers` Resource implements the WikiJS API mutatation `rendering{updateRenderers{renderers{…}}}`. | ||
|
||
**Be aware**. | ||
This Resource supports only one instance as the implementation needs the complete configuration of renderers. | ||
You cannot specify one renderer with its config as this will erase the complete list. | ||
If you are unsure about the `key` and `config` fields, you can query the API after activating it manually or with the `wikijs_api` resource. | ||
The query with the minimal information you need is as follows: | ||
|
||
```graphql | ||
query{ | ||
rendering{ | ||
renderers{ | ||
title, | ||
key, | ||
isEnabled, | ||
config{ | ||
key, | ||
value | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The `title` field is not needed in the `wikijs_renderers` Resource but is necessary for the graphql query. | ||
You get back a JSON in the `config.value` field where you have to look for another `value` field. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# This is a _currently_ complete configuration for the renderers. If you | ||
# add your own renderer, place the object in this list. | ||
# The order of this example is as it can be found in the backend for | ||
# easier working. | ||
resource "wikijs_renderers" "wikijs_renderers" { | ||
renderers = [ | ||
{ | ||
key = "openapiCore" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "markdownCore" | ||
is_enabled = true | ||
config = { | ||
"allowHTML" = true | ||
"linkify" = true | ||
"linebreaks" = true | ||
"underline" = false | ||
"typographer" = false | ||
# This field is an enum and has the following available values: | ||
# "Chinese", "English", "French", "German", "Greek", "Japanese", | ||
# "Hungarian", "Polish", "Portuguese", "Russian", "Spanish", | ||
# "Swedish" | ||
"quotes" = "English" | ||
} | ||
}, | ||
{ | ||
key = "markdownAbbr" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "markdownEmoji" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "markdownExpandtabs" | ||
is_enabled = true | ||
config = { | ||
"tabWidth" = 4 | ||
} | ||
}, | ||
{ | ||
key = "markdownFootnotes" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "markdownImsize" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "markdownKatex" | ||
is_enabled = true | ||
config = { | ||
"useInline" : true | ||
"useBlocks" : true | ||
} | ||
}, | ||
{ | ||
key = "markdownKroki" | ||
is_enabled = false | ||
config = { | ||
"server" = "https://kroki.io" | ||
"openMarker" = "```kroki" | ||
"closeMarker" = "```" | ||
} | ||
}, | ||
{ | ||
key = "markdownMathjax" | ||
is_enabled = false | ||
config = { | ||
"useInline" = true | ||
"useBlocks" = true | ||
} | ||
}, | ||
{ | ||
key = "markdownMultiTable" | ||
is_enabled = false | ||
config = { | ||
"headerlessEnabled" = true | ||
"multilineEnabled" = true | ||
"rowspanEnabled" = true | ||
} | ||
}, | ||
{ | ||
key = "markdownPivotTable" | ||
is_enabled = false | ||
config = {} | ||
}, | ||
{ | ||
key = "markdownPlantuml" | ||
is_enabled = true | ||
config = { | ||
"server" = "https://plantuml.requarks.io" | ||
"openMarker" = "```plantuml" | ||
"closeMarker" = "```" | ||
"imageFormat" = "svg" | ||
} | ||
}, | ||
{ | ||
key = "markdownSupsub" | ||
is_enabled = true | ||
config = { | ||
"subEnabled" = true | ||
"supEnabled" = true | ||
} | ||
}, | ||
{ | ||
key = "markdownTasklists" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "asciidocCore" | ||
is_enabled = true | ||
config = { | ||
# This field is an enum and has the following available values: | ||
# "unsafe", "safe", "server", "secure" | ||
"safeMode" = "server" | ||
} | ||
}, | ||
{ | ||
key = "htmlCore" | ||
is_enabled = true | ||
config = { | ||
"absoluteLinks" = false | ||
"openExternalLinkNewTab" = false | ||
# This field is an enum and has the following available values: | ||
# "noreferrer", "noopener" | ||
"relAttributeExternalLink" = "noreferrer" | ||
} | ||
}, | ||
{ | ||
key = "htmlAsciinema" | ||
is_enabled = false | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlBlockquotes" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlCodehighlighter" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlDiagram" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlImagePrefetch" | ||
is_enabled = false | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlMediaplayers" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlMermaid" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlSecurity" | ||
is_enabled = true | ||
config = { | ||
"safeHTML" = true | ||
"allowDrawIoUnsafe" = true | ||
"allowIFrames" = false | ||
} | ||
}, | ||
{ | ||
key = "htmlTabset" | ||
is_enabled = true | ||
config = {} | ||
}, | ||
{ | ||
key = "htmlTwemoji" | ||
is_enabled = true | ||
config = {} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `renderers` (Attributes List) (see [below for nested schema](#nestedatt--renderers)) | ||
|
||
<a id="nestedatt--renderers"></a> | ||
### Nested Schema for `renderers` | ||
|
||
Required: | ||
|
||
- `is_enabled` (Boolean) Is the renderer enabled or not. | ||
- `key` (String) The registered/machine name of the renderer used to identify it in the system. | ||
|
||
Optional: | ||
|
||
- `config` (Map of String) Map with config options for this specific renderer. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Use this data source to query the current setup and make changes in | ||
# certain renderers. Note that this data source only takes an empty | ||
# renderers list. | ||
data "wikijs_theme_renderers" "renderers" { | ||
renderers = [] | ||
} |
Oops, something went wrong.