Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using markdown in the extensions #9

Open
voz opened this issue Oct 5, 2017 · 9 comments
Open

Using markdown in the extensions #9

voz opened this issue Oct 5, 2017 · 9 comments

Comments

@voz
Copy link

voz commented Oct 5, 2017

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.

@RobWin
Copy link
Member

RobWin commented Oct 5, 2017

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

@voz
Copy link
Author

voz commented Oct 5, 2017

@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']
}

@RobWin
Copy link
Member

RobWin commented Oct 5, 2017

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

@voz
Copy link
Author

voz commented Oct 5, 2017

@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 :)

@RobWin
Copy link
Member

RobWin commented Oct 10, 2017

In the meantime, can you use AsciiDoc instead?

@voz
Copy link
Author

voz commented Oct 10, 2017

@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?

@Stoakes
Copy link

Stoakes commented Feb 7, 2018

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.

@RobWin
Copy link
Member

RobWin commented Feb 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants