widdershins
widdershins copied to clipboard
Allow reusing instance to convert multiple documents
I'm running widdershins from a node app, converting a set of openapi definition documents (about 16 documents) into markdown (to feed into shins). I don't see how to reuse the instance effectively. As is, I run
converter.convert(openapiObj, options, function (err, markdownString) { ... }
inside a loop, and this ends up reading/parsing all the templates on each OpenAPI definition.
Describe the solution you'd like Provide access to the instance after initializing it, i.e.
converter.load(options); // or converter.initialize()
which can then be reused to convert multiple documents.
(Note: for my use case, all documents use the same set of options.)
Alternatively, let converter
retain state, so it does not have to reparse everything each time convert
is called.
Is this just a performance / efficiency enhancement? I think parsing the templates probably takes less time than formatting the actual output of each input document...
It's minor. The processing log gets swamped by all the repeated lines about loading all the template files and is thus harder to view or track.
Note: should only be happening if options.user_templates
is set...
yes, I'm using user_templates
...