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

[docs] Add basic documentation on using Snippets to DocC documentation #1166

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

heckj
Copy link
Member

@heckj heckj commented Mar 5, 2025

Work towards resolving #417

Summary

Adds some base line documentation that describes how to use the snippets feature built in to DocC and the DocC Plugin.

  • how to add snippets to your project
  • how to run and verify the snippets
  • how to make slices in a snippet
  • how to reference the snippet, or a slice from a snippet, from within another DocC catalog entry

Dependencies & Testing

  • no dependencies
  • visually inspected with a local preview build of the DocC documentation for testing

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests (no tests, doc updates only)
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

(this pull request is the combined work of https://github.com/JacobHearst and myself, I just happen to be submitting it)

Co-authored-by: Joe Heck <[email protected]>
Co-authored-by: Jacob Hearst <[email protected]>
@heckj heckj changed the title Add basic documentation on using Snippets to DocC documentation [docs] Add basic documentation on using Snippets to DocC documentation Mar 5, 2025
@d-ronnqvist d-ronnqvist added the documentation Improvements or additions to documentation label Mar 6, 2025
@d-ronnqvist
Copy link
Contributor

(this pull request is the combined work of https://github.com/JacobHearst and myself, I just happen to be submitting it)

FYI: You can coauthor commits by including a line like this in the commit message:

Co-authored-by: Jacob Hearst <[email protected]>

@@ -0,0 +1,26 @@
# ``docc/Snippet``
Copy link
Contributor

Choose a reason for hiding this comment

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

This page won't be displayed as long as the snippet symbol isn't in the symbol graph file of directives that this catalog uses.

To include it you'd need to remove this hiddenFromDocumentation = true line and then run swift run generate-symbol-graph in the DocC repo and commit the modified symbol graph file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you! I don't know how long it would have taken me to hunt down that detail without your guidance!

Comment on lines +7 to +13
...tbd...
- Describe the problem and summarize the developer action.
- Explain why the problem is relevant and provide context for the task. Don't simply repeat the abstract; expand on it.
- Keep the Overview to one or two paragraphs.
- For very short articles that consist of just a couple of paragraphs, all of the content can be in the Overview.

...tbd...
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be good to assume that the reader doesn't know the destination between a code snippet and a markdown code block element and lead with that information. A reader who finds this information might be overwhelmed of all the steps if all they want to do is to write a code block in their markup. That distinction might serve as a good segue to the benefits of compiled code examples which lets the reader make an informed decision about using code blocks or code snippets in their documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants