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

Expose types and functions of package #250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

l0nax
Copy link

@l0nax l0nax commented Sep 27, 2024

I'm very grateful for this project, and I really like it. Thanks for all your effort :)

The reason behind this PR is that I want a more pkg.go.dev like experience, i.e. a sidebar/ navbar that updates based on the position on the page, etc.

@abhinav
Copy link
Owner

abhinav commented Sep 28, 2024

Thanks for the PR, @l0nax. It makes sense to expose this information in the front matter data—I assume you're using this information somehow to fill a TOC?

That said, I don't think the raw godoc.Types should be exposed.
Those include a lot of the information needed to render the HTML, and don't necessarily have a stable shape.
For example, none of the decl-rendering or comment rendering logic will work in the frontmatter template.

If we could instead create a copy of a subset of that information for frontmatterData, that would be much better.
For example, for the types, we would probably have:

type frontmatterType struct {
  Name string

  Constants, Variables []*frontmatterValue
  // ..
}

type frontmatterValue struct {
  Names []string
}

It'll need a little boilerplate to build this mirror subset, but it'll be a stable API for the frontmatter templates that I can commit to not breaking in the future.

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.

2 participants