danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 480 forks source link

Parameter for always expanded request / response panels #149

Open petrdvorak opened 9 years ago

petrdvorak commented 9 years ago

It would be nice to allow generating HTML files with expanded (and non-collapsible) requests and responses, so that you can just read the documentation without requiring expanding collapsed documentation items. It could be done by adding a template parameter and fixing the mixins file...

obihann commented 9 years ago

I agree, this would be great!

evnm commented 8 years ago

This feature would be great. I have a use case where I collect a set of API documentation into a PDF by generating static HTML and then running the HTML through wkhtmltopdf. By default, request/response panels are hidden in the produced PDFs.

I'm currently doing s/collapse-button"/collapse-button show"/g on the HTML output by aglio. I'd love to remove this hack in favor of simply passing an option during the HTML generation step.

PavelPolyakov commented 8 years ago

This would be great, just tried to search for it.

reustonium commented 8 years ago

@evnm would you mind sharing an example of how you perform that operation?

evnm commented 8 years ago

No problem. Adjacent to my .apib file(s) is a Makefile with something like the following snippet:

APIB_FILE = foo.apib
HTML_FILE = bar.html
PDF_FILE = baz.pdf
AGLIO_BIN = ./node_modules/aglio/bin/aglio.js

html: $(APIB_FILE) ## Generate static HTML files of API documentation
    mkdir -p $(DIST_DIR)
    $(AGLIO_BIN) -i $(APIB_FILE) -o $(HTML_FILE)
    sed -e 's/collapse-button"/collapse-button show"/g' -i '' $(HTML_FILE)

pdf: html ## Generate PDF (and HTML) files of API documentation
    wkhtmltopdf --print-media-type $(HTML_FILE) $(PDF_FILE)

I can then run make html or make pdf to generate the appropriate doc file, depending on whether I need to create a simple static website or email a customer a PDF.