Skip to content

Is it possible to add a customer redoc template? #17

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
ohenrik opened this issue Jul 18, 2024 · 1 comment
Open

Is it possible to add a customer redoc template? #17

ohenrik opened this issue Jul 18, 2024 · 1 comment

Comments

@ohenrik
Copy link

ohenrik commented Jul 18, 2024

I wish to use a different template than the the one provided by this package. Is it possible to do this with the current version of go-redoc? Or will it require a PR?

@PhilRanzato
Copy link

It would be awesome for me too.
I don't think that's possible now

go-redoc/redoc.go

Lines 31 to 54 in 101384b

// JavaScript represents the redoc standalone javascript
//
//go:embed assets/redoc.standalone.js
var JavaScript string
// Body returns the final html with the js in the body
func (r Redoc) Body() ([]byte, error) {
buf := bytes.NewBuffer(nil)
tpl, err := template.New("redoc").Parse(HTML)
if err != nil {
return nil, err
}
if err = tpl.Execute(buf, map[string]string{
"body": JavaScript,
"title": r.Title,
"url": r.SpecPath,
"description": r.Description,
}); err != nil {
return nil, err
}
return buf.Bytes(), nil
}

The file is embedded

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

No branches or pull requests

2 participants