You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To generate and then print JSON documentation to stdout, run:
169
169
170
170
```
171
-
$ puppet strings generate --emit-json-stdout
171
+
$ puppet strings generate --format json
172
172
```
173
173
174
174
For details about Strings JSON output, see [Strings JSON schema](https://github.com/puppetlabs/puppet-strings/blob/master/JSON.md).
175
175
176
+
### Output documents in Markdown
177
+
178
+
Strings can also produce documentation in Markdown and then either generate an `.md` file or print Markdown to stdout. The generated markdown layout has been reviewed and approved by Puppet's tech pubs team and is the same that is used in Puppet Supported modules.
179
+
180
+
To generate Markdown documentation to a file, run:
To generate and then print JSON documentation to stdout, run:
187
+
188
+
```
189
+
$ puppet strings generate --format markdown
190
+
```
191
+
176
192
### Output documents to GitHub Pages
177
193
178
194
To generate documents and then make them available on [GitHub Pages](https://pages.github.com/), use the Strings rake task `strings:gh_pages:update`. See [Rake tasks](#rake-tasks) for setup and usage details.
@@ -285,6 +301,35 @@ end
285
301
286
302
All provider method calls, including `confine`, `defaultfor`, and `commands`, are automatically parsed and documented by Strings. The `desc` method is used to generate the docstring, and can include tags such as `@example` if written as a heredoc.
287
303
304
+
Document types that use the new [Resource API](https://github.com/puppetlabs/puppet-resource_api).
305
+
306
+
```ruby
307
+
Puppet::ResourceApi.register_type(
308
+
name:'database',
309
+
docs:'An example database server resource type.',
310
+
attributes: {
311
+
ensure: {
312
+
type:'Enum[present, absent, up, down]',
313
+
desc:'What state the database should be in.',
314
+
default:'up',
315
+
},
316
+
address: {
317
+
type:'String',
318
+
desc:'The database server name.',
319
+
behaviour::namevar,
320
+
},
321
+
encrypt: {
322
+
type:'Boolean',
323
+
desc:'Whether or not to encrypt the database.',
324
+
default:false,
325
+
behaviour::parameter,
326
+
},
327
+
},
328
+
)
329
+
```
330
+
331
+
Here, the `docs` key acts like the `desc` method of the traditional resource type. Everything else is the same, except that now everything is a value in the data structure, not passed to methods.
332
+
288
333
**Note**: Puppet Strings can not evaluate your Ruby code, so only certain static expressions are supported.
0 commit comments