Add RenderFieldHTML and RenderValidation to Markdown rendering - #202
Open
youngnick wants to merge 1 commit into
Open
Add RenderFieldHTML and RenderValidation to Markdown rendering#202youngnick wants to merge 1 commit into
youngnick wants to merge 1 commit into
Conversation
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>
|
❌ Author of the following commits did not sign a Contributor Agreement: Please, read and sign the above mentioned agreement if you want to contribute to this project |
Author
|
Ah, I will have to check if I'm allowed to sign the CLA, I'll get back to you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds two functions to Markdown rendering:
Markdown inside the godoc field description, and renders it into a
single-line HTML, for inclusion in a Markdown table without
breaking the table.
handling for
Required: {}andOptional: {}fields (listsas 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:

To this:

(with some other template changes).
If this PR is okay, I am happy to contribute the template we are using as well.