widdershins icon indicating copy to clipboard operation
widdershins copied to clipboard

Error picking up user templates

Open MikeAdamsMews opened this issue 4 months ago • 1 comments

Describe the bug I cannot get Widdershins to pick up and use my custom template. I'm sure I must be doing something wrong, but it's hard to diagnose when there is no apparent confirmation or otherwise that it is picking up a user template, because the default behavior is to use the standard template.

I'm running Widdershins CLI on Mac with variations of this command:

widdershins 'swagger.yaml' -o 'openapi.md' -u 'mytemplates'

I've tried './mytemplates' instead of 'mytemplates', as well as trying the absolute path obtained through $realpath, but it makes no difference.

I have a sub-directory called mytemplates and in that I have copied the contents of openapi3 from the Widdershins template sub-directory and I've edited the main.dot file with a simple edit to test if it's picking up this version and not the default version. My change is to remove the following line of Markdown which appears in the header of the output file.

> Scroll down for {{? data.header.language_tabs.length}}code samples, {{?}}example requests and responses.{{? data.header.language_tabs.length}} Select a language for code samples from the tabs above or the mobile navigation menu.{{?}}

When I run the command, the deleted Markdown still appears in the output file, indicating that it is not processing my custom main.dot.

I have no indication of the cause of the error:

  • Is it not finding my user template directory, maybe because I have specified it incorrectly?
  • Is there some other reason why it is ignoring my main.dot?

I am pretty sure this must be an error on my part and not in Widdershins, but I'm running out of ideas. And at the very least, it would be good to have some diagnostics support, e.g. if the -u option is used then it should report an error if it can't find or can't process the custom template.

  • [x] - I have checked that my input document is valid OpenAPI 2.0/3.0.x or AsyncAPI 1.x

To Reproduce Steps to reproduce the behavior:

  1. Command-line: widdershins 'swagger.yaml' -o 'openapi.md' -u 'mytemplates'
  2. My input file: (please link to a gist) swagger.yaml
  3. My user template is mytemplates/openapi3 with main.dot edited as described above.
  4. Output file openapi1.md still contains the Markdown "Scroll down for..." (as above)

Expected behavior Output file openapi1.md should not contain the Markdown "Scroll down for..." (as above)

Screenshots n/a

Versions:

  • Node.js (note only LTS versions are supported): v18.11.0 but same result with v20.11.0

Additional context n/a

MikeAdamsMews avatar Feb 08 '24 17:02 MikeAdamsMews