Skip to content

Commit 6383098

Browse files
committed
Update README
1 parent db88cd9 commit 6383098

1 file changed

Lines changed: 47 additions & 2 deletions

File tree

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,33 @@ Strings can produce documentation in JSON and then either generate a `.json` fil
162162
To generate JSON documentation to a file, run:
163163

164164
```
165-
$ puppet strings generate --emit-json documentation.json
165+
$ puppet strings generate --format json --out documentation.json
166166
```
167167

168168
To generate and then print JSON documentation to stdout, run:
169169

170170
```
171-
$ puppet strings generate --emit-json-stdout
171+
$ puppet strings generate --format json
172172
```
173173

174174
For details about Strings JSON output, see [Strings JSON schema](https://github.com/puppetlabs/puppet-strings/blob/master/JSON.md).
175175

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:
181+
182+
```
183+
$ puppet strings generate --format markdown --out REFERENCE.md
184+
```
185+
186+
To generate and then print JSON documentation to stdout, run:
187+
188+
```
189+
$ puppet strings generate --format markdown
190+
```
191+
176192
### Output documents to GitHub Pages
177193

178194
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
285301

286302
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.
287303

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+
288333
**Note**: Puppet Strings can not evaluate your Ruby code, so only certain static expressions are supported.
289334

290335
### Documenting functions

0 commit comments

Comments
 (0)