puppetlabs / puppetlabs/puppet-strings

Support languages other than puppet within @example blocks

Open
#233 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Ruby
Stars
90
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Use Case

Be able to provide examples in other languages in particular YAML.
Currently all @example blocks are assumed to be puppet language.

Describe the Solution You Would Like

Don't really know yardoc so guessing what a syntax might be

@example(yaml) Specify a Yum repo
---
yum::repos:
    base:
        baseurl: 'https://repos.example.com/CentOS/base/'
        mirrorlist: '--'

A clear and concise description of what you want to happen.

Should be rendered as the following with pretty yaml.

# Example - Specify a yumrepo
---
yum::repos:
    base:
        baseurl: 'https://repos.example.com/CentOS/base/'
        mirrorlist: '--'

Describe Alternatives You've Considered

Folk have tried nesting a yaml code block but it turns weird.
(have used ' rather than ``` for the inner code block)

@example an example
'''yaml
---
foo:bar
'''

however this results in nonsense output.

Additional Context

Stems on from this merge request to clean up some previous attempts to render yaml.

https://github.com/voxpupuli/puppet-yum/pull/171

which resulted a completely broken markdown result.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how @example blocks are parsed and rendered, then inspect the existing handling of Puppet examples and the markdown output. Use the YAML example and the linked puppet-yum pull request as reproduction material; done means a language-qualified example renders as readable YAML without breaking existing examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, yaml
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.