Skip to content
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

feat(core): Adding examples docs, mainly policy commands #461

Merged
merged 7 commits into from
Jan 7, 2025

Conversation

elizabethhealy
Copy link
Member

@elizabethhealy elizabethhealy commented Dec 18, 2024

Mainly for docs.opentdf.io

@elizabethhealy elizabethhealy changed the title feat(docsadding examples to policy commands feat(docs): Adding examples to policy commands Dec 18, 2024
@elizabethhealy elizabethhealy changed the title feat(docs): Adding examples to policy commands feat(core): Adding examples docs, mainly policy commands Dec 18, 2024
@elizabethhealy elizabethhealy marked this pull request as ready for review December 18, 2024 16:00
@elizabethhealy elizabethhealy requested a review from a team as a code owner December 18, 2024 16:00
@jakedoublev
Copy link
Contributor

If you run one of the commands with -h in a smaller terminal window, how does the markdown render output appear? Could you please attach screenshots with different terminal sizes for reference in the PR?

@jrschumacher
Copy link
Member

@elizabethhealy I think Jake brings up some good points. Could we add this output to another header which we can exclude from the CLI output? I'm open to suggestions that would allow this to be uniform. We use this function to style the docs which would allow you to strip any sections that should be omitted from the CLI docs.

I believe when I added example I didn't give an example of the output: https://github.com/opentdf/otdfctl/blob/main/docs/man/auth/client-credentials.md#examples

Finally, I think we need to cement the CLI that we are modeling our docs after, but when I've been doing it I tend to use man git, man ssh, and man openssl.

@elizabethhealy
Copy link
Member Author

elizabethhealy commented Dec 19, 2024

@elizabethhealy I think Jake brings up some good points. Could we add this output to another header which we can exclude from the CLI output? I'm open to suggestions that would allow this to be uniform. We use this function to style the docs which would allow you to strip any sections that should be omitted from the CLI docs.

I believe when I added example I didn't give an example of the output: https://github.com/opentdf/otdfctl/blob/main/docs/man/auth/client-credentials.md#examples

Finally, I think we need to cement the CLI that we are modeling our docs after, but when I've been doing it I tend to use man git, man ssh, and man openssl.

@jrschumacher i like this idea, is there a way to pick which headers are displayed in the help output? ideally i think id like both the input and output in whats displayed on the docs website but only the input on the help command

@jrschumacher
Copy link
Member

@elizabethhealy yep in the styledoc function you should be able to iterate. We will need to add https://github.com/yuin/goldmark to parse the markdown and strip out the headers we don't want. Whether you strip before styling is up to you, but we do include https://github.com/charmbracelet/glamour for styling the markdown which also uses goldmark.

If you could just add a README to the man directory so we can keep track of the special headers or header tags.

Lastly in opentdf/docs there is a custom react component used to render the markdown into HTML. Inn that you can iterate and add or remove new elements.

@jakedoublev
Copy link
Contributor

This is great! Looks like there are still example outputs for KAS grants and SCS creation, but this should be good to go after those are removed. 🎉

@elizabethhealy
Copy link
Member Author

@jakedoublev thanks good catch! should be ready now.
i played around with goldmark a bit but just removed the output for the short term, figured i can come back to it on engineering day since its just a nice to have

@elizabethhealy elizabethhealy merged commit 04c1743 into main Jan 7, 2025
3 checks passed
@elizabethhealy elizabethhealy deleted the add-examples-to-policy-commands branch January 7, 2025 16:33
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.

4 participants