Skip to content

Fix YAML syntax, adjust more code block languages #2408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2025

Conversation

felixfontein
Copy link
Collaborator

I went through the problems mentioned by #2385 after #2382 got merged.

Quite a few places were things like ... in YAML to indicate "some more content here". I usually replaced it by # ....

Another large set (especially in the filters documentation) was something that was a Jinja template, but not really YAML. I usually tagged them as jinja instead. Everything that is tagged yaml+jinja should be syntactially valid YAML. That also means I had to change back #2382 (comment) since this Jinja template cannot be made valid YAML, due to the value for dependencies, which must be a dictionary, and cannot be (in Ansible-style) a YAML string that evaluates to a dictionary.

@felixfontein felixfontein added the backport-2.18 Automatically create a backport for the stable-2.18 branch label Feb 12, 2025
@felixfontein felixfontein marked this pull request as draft February 12, 2025 18:47
@felixfontein felixfontein marked this pull request as ready for review February 12, 2025 18:47
@felixfontein felixfontein requested a review from oraNod February 13, 2025 20:33
Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this @felixfontein This is great attention to detail and definitely improves the overall quality of the docs. It's much appreciated.

I've left one follow on comment about the console lexer but don't think it's worth getting hung up on. Cheers.

@@ -361,7 +361,7 @@ and type in the vault password for ``my_user``.

The :option:`--vault-id <ansible-playbook --vault-id>` flag allows different vault passwords for different users or different levels of access. The output includes the username ``my_user`` from your ``ansible-vault`` command and uses the YAML syntax ``key: value``:

.. code-block:: yaml
.. code-block:: text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. code-block:: text
.. code-block:: console

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I thought this might be console but now I'm not so sure looking at some of the changes you have below. Given this represents sample output console would make sense, wouldn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixfontein The code-blocks preceding this one are console. Looking at it again, I still think there is a case for console over text. Looking at the pygment docs for the lexer: https://pygments.org/docs/lexers/#pygments.lexers.shell.BashSessionLexer

This code block, while not showing a direct command like the previous ansible-vault examples, is intended to show the output of the --vault-id flag and is in the context of a shell session.

I'm probably being waaaay too pedantic about it though. I don't feel super strongly but am not convinced text is better than console.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think console only really makes sense if there's also a prompt involved. The lexer is for formatting prompts, commands, and output differently. Here you can just see program output.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH some of the other ones I've tagged as 'console' likely aren't really console either.

I'm going to keep this one and the others as-is for now, maybe at some point someone has to take a closer look at all these at once. At least now all code blocks are tagged with a language, so they're easier to find :)

@felixfontein felixfontein merged commit d8c36a0 into ansible:devel Feb 14, 2025
11 checks passed
@felixfontein felixfontein deleted the yaml-syntax branch February 14, 2025 21:06
Copy link

patchback bot commented Feb 14, 2025

Backport to stable-2.18: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-2.18/d8c36a014f305acafed82cc3c2d699053f22a9c9/pr-2408

Backported as #2419

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator Author

@oraNod thanks for reviewing!

patchback bot pushed a commit that referenced this pull request Feb 14, 2025
* Fix broken YAML, or adjust code block type.

* Normalize code block type.

(cherry picked from commit d8c36a0)
felixfontein added a commit that referenced this pull request Feb 14, 2025
* Fix broken YAML, or adjust code block type.

* Normalize code block type.

(cherry picked from commit d8c36a0)

Co-authored-by: Felix Fontein <[email protected]>
ketankelkar pushed a commit to ketankelkar/ansible-documentation that referenced this pull request Feb 18, 2025
* Fix broken YAML, or adjust code block type.

* Normalize code block type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-2.18 Automatically create a backport for the stable-2.18 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants