Skip to content

Improve documentation printer #4529

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

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

Conversation

GearsDatapacks
Copy link
Member

This PR closes #2629, closes #828 and closes #3461
This PR is a continuation of #3471, thanks @yoshi-monster for doing the initial work!
What I've done in this PR:

  • Extracted the logic for printing the definitions of types and values from the formatter, and made a docs::printer::Printer struct.
  • This struct now prints highlighting HTML tags, because as Yoshi discovered, highlight.js doesn't support links.
  • To support that, I've added a ZeroWidthString variant to the Document enum in the pretty printing module
  • While I was doing this, I thought it made sense to rework the type printing for these, so we now have proper type-variable printing and module qualifiers.
  • Since the snapshots were very large (~400 lines each), I've made a new function to pretty-print the generated documentation, including a way to turn off all the HTML highlighting so we can properly see the generated code.

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Fantastic!! Thank you!!

Some small notes inline

@GearsDatapacks GearsDatapacks marked this pull request as draft May 2, 2025 17:01
@GearsDatapacks GearsDatapacks force-pushed the improve-docs-printer branch from 14f928f to a9ecf46 Compare May 2, 2025 17:55
@GearsDatapacks GearsDatapacks marked this pull request as ready for review May 2, 2025 17:55
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Fantastic! Thank you so much! I've added one small comment inline 🙏

@GearsDatapacks GearsDatapacks marked this pull request as draft May 4, 2025 12:17
@GearsDatapacks GearsDatapacks force-pushed the improve-docs-printer branch from d4f572a to 11ed8c8 Compare May 4, 2025 16:27
@GearsDatapacks GearsDatapacks marked this pull request as ready for review May 4, 2025 16:27
@GearsDatapacks
Copy link
Member Author

The links should all be correct now. These changes require a bit more plumbing as we now need information from the manifest about what specific version of a package is being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants