Skip to content

Add RenderFieldHTML and RenderValidation to Markdown rendering - #202

Open
youngnick wants to merge 1 commit into
elastic:masterfrom
youngnick:add-html-field-render
Open

Add RenderFieldHTML and RenderValidation to Markdown rendering#202
youngnick wants to merge 1 commit into
elastic:masterfrom
youngnick:add-html-field-render

Conversation

@youngnick

Copy link
Copy Markdown

This PR adds two functions to Markdown rendering:

  • RenderFieldHTML: This function assumes that field documentation is
    Markdown inside the godoc field description, and renders it into a
    single-line HTML, for inclusion in a Markdown table without
    breaking the table.
  • RenderValidation: This function renders validation with special
    handling for Required: {} and Optional: {} fields (lists
    as Required and Optional respectively).

It also includes a small change to RenderDefault that wraps JSON
defaults in backticks to make them slightly easier to pick out.

This is intended for use in the Gateway API template, and changes the docs for complex fields from this:
Screenshot 2026-08-10 at 4 56 25 pm

To this:
Screenshot 2026-08-10 at 4 53 33 pm

(with some other template changes).

If this PR is okay, I am happy to contribute the template we are using as well.

This commit adds two functions to Markdown rendering:

- RenderFieldHTML: This function assumes that field documentation is
  Markdown inside the godoc field description, and renders it into a
  single-line HTML, for inclusion in a Markdown table without
  breaking the table.
- RenderValidation: This function renders validation with special
  handling for `Required: {}` and `Optional: {}` fields (lists
  as _Required_ and _Optional_ respectively).

It also includes a small change to RenderDefault that wraps JSON
defaults in backticks to make them slightly easier to pick out.

Signed-off-by: Nick Young <nick@isovalent.com>
@cla-checker-service

Copy link
Copy Markdown

❌ Author of the following commits did not sign a Contributor Agreement:
3fbd32c

Please, read and sign the above mentioned agreement if you want to contribute to this project

@youngnick

Copy link
Copy Markdown
Author

Ah, I will have to check if I'm allowed to sign the CLA, I'll get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant