swagger2markup-maven-project-template icon indicating copy to clipboard operation
swagger2markup-maven-project-template copied to clipboard

Using markdown in the extensions

Open voz opened this issue 7 years ago • 9 comments

Thanks for this project template! It works great for asciidoc doc extensions as they are used in the project right now.

Is it possible to employ markdown extensions instead?

Just renaming .adoc files into .md and changing the text inside seems not to work: the extensions do not appear in the generated docs.

voz avatar Oct 05 '17 13:10 voz

Thx. Please have a look at http://swagger2markup.github.io/swagger2markup/1.3.1/ chapter 5.5.1 configuration

RobWin avatar Oct 05 '17 15:10 RobWin

@RobWin thanks, I've checked and I see the parameter swagger2markup.extensions.dynamicOverview.markupLanguage which I specified in my gradle task below.

Indeed, the conversion of markdown to asciidoc now happens but as long as the extension of the file is .adoc. If I change the extension of the file with markdown into .md then the converted content doesn't appear anymore in the generated overview.adoc. Any idea why?

convertSwagger2markup {
    swaggerInput file("src/docs/swagger/swagger_petstore.yaml").getAbsolutePath()
    outputDir asciiDocOutputDir
    config =['swagger2markup.markupLanguage' : 'ASCIIDOC',
              'swagger2markup.outputLanguage' : 'EN',
              'swagger2markup.pathsGroupedBy' : 'TAGS',
              'swagger2markup.generatedExamplesEnabled' : 'true',
              'swagger2markup.pathSecuritySectionEnabled' : 'false',
              'swagger2markup.basePathPrefixEnabled' : 'true',
              'swagger2markup.extensions.dynamicDefinitions.contentPath' : file('src/docs/asciidoc/extensions/definitions').absolutePath,
              'swagger2markup.extensions.dynamicDefinitions.markupLanguage' : 'MARKDOWN',
              'swagger2markup.extensions.dynamicOverview.contentPath' : file('src/docs/asciidoc/extensions/overview').absolutePath,
              'swagger2markup.extensions.dynamicOverview.markupLanguage' : 'MARKDOWN',
              'swagger2markup.extensions.dynamicPaths.contentPath' : file('src/docs/asciidoc/extensions/paths').absolutePath,
              'swagger2markup.extensions.dynamicPaths.markupLanguage' : 'MARKDOWN',
              'swagger2markup.extensions.dynamicSecurity.contentPath' : file('src/docs/asciidoc/extensions/security').absolutePath,
              'swagger2markup.extensions.dynamicSecurity.markupLanguage' : 'MARKDOWN']
}

voz avatar Oct 05 '17 15:10 voz

Yes, you can only use .md files when you change swagger2markup.markupLanguage to MARKDOWN, as far as I remember.

RobWin avatar Oct 05 '17 16:10 RobWin

@RobWin the problem is that markdown in .md doesn't work even when I set swagger2markup.markupLanguage to MARKDOWN. I can write markdown in .adocand it works with the parameter set, but not in .md. Let me know if I explained it clearly :)

voz avatar Oct 05 '17 18:10 voz

In the meantime, can you use AsciiDoc instead?

RobWin avatar Oct 10 '17 13:10 RobWin

@RobWin yes, going to use AsciiDoc for now. Maybe, I'll get some time to investigate the cause for .md not working. Any hint where to look?

voz avatar Oct 10 '17 15:10 voz

It should be the import files extension. See https://github.com/Swagger2Markup/swagger2markup-extensions/blob/master/swagger2markup-import-files-ext/src/main/java/io/github/swagger2markup/extensions/DynamicDefinitionsDocumentExtension.java

RobWin avatar Oct 10 '17 16:10 RobWin

Hi,

I'm dealing with the same issue. My current workaround is to use .md.adoc as file extension, but it is more a hack than a real solution.

I've been looking at your code to figure out if I could open a pull request to fix that behaviour. But I don't see where the extensionMarkupLanguage is managed.

Stoakes avatar Feb 07 '18 12:02 Stoakes

Hi, the bug might be in this line: https://github.com/Swagger2Markup/swagger2markup-extensions/blob/d572be66b65acf9f34dc42022c4fc15c241aa325/swagger2markup-extension-commons/src/main/java/io/github/swagger2markup/extensions/DynamicContentExtension.java#L55

If swagger2markup.markupLanguage is ASCIIDOC, we are looking only for files with a adoc extension. If swagger2markup.markupLanguage is MARKDOWN, we are looking only for files with a md extension.

The extensionMarkupLanguage is only used to check if we need to convert MARKDOWN into ASCIIDOC. But instead we should also use it to look for files with a md extension.

RobWin avatar Feb 12 '18 07:02 RobWin