Supporting to embeding pretty-swag within html
Closed this issue · 4 comments
Hi @twskj
The produced html includes css, html header, html body tag, js, etc.
Would be nice if one could turn off these outputs essentially producing plain static html.
Then one can simple include the output into a div locally and style it as required.
I appreciate your advice,
Ali
Thanks for pointing this out. Currently, pretty-swag does not generated div
format yet. Its content get "hydrated" at run time by javascript.
This sounds like the same issue as #26. I am still looking for a solution. Solutions I am looking at are:
- Chrome headless rendering.
- Simple server-side template on node like
ejs
Each has pros/cons but I am leaning toward the second choice because it has less restrictions but a big chunk of work has to put on developing a new template.
If you have other ideas, feel free to discuss here.
Also pull request is always welcome if you have time to solve this before me 👍
Cheers
to make sure I understand the process correctly.
pretty-swag converts swagger doc into an intermediate format
livedoc is what generates the html, so to get output I am after I need to:
- introduce new option in pretty-swag
- intercept the option in livedoc and generate the output.
Any advice ?
Ali
yup you got it right. You can also intercept raw parsing data and not use livedoc at all. The parsing result is in json format. Take that json and loop over data to generate html however you like.