kordamp / markdown-gradle-plugin

Markdown/HTML plugin for gradle
Apache License 2.0
71 stars 51 forks source link

Have to do a nasty workaround to configure Pegdown #19

Closed lluppani closed 4 years ago

lluppani commented 8 years ago

Theres a bug in this peace of code while configuring on class MarkdownProcessor.groovy.

In line 216 it must say customizePegdown, not customizeRemark.

if (conf.customizePegdown) {
    def exts = conf.customizeRemark(result.pegdownExtensions)
    if (exts instanceof Integer) {
         result.pegdownExtensions = (int) exts
    }
}

As it's now I have to do both configurations to get Pegdown properly configured.

chriswhite199 commented 8 years ago

@lluppani are you able to share your workaround, I have similar requirements to add in the ANCHORLINKS pegdown extension and can't seem to get it to work:

markdownToHtml.customizePegdown = { int extensions ->
    return extensions | org.pegdown.Extensions.ANCHORLINKS
}

markdownToHtml.customizeRemark = { int extensions ->
    return extensions | org.pegdown.Extensions.ANCHORLINKS
}

yields:

* What went wrong:
No signature of method: build_6uodcaqx46r6nkfcd8j12l0s$_run_closure11.doCall() is applicable for argument types: () values: []
Possible solutions: doCall(int), isCase(java.lang.Object), isCase(java.lang.Object), findAll(), findAll(), findAll(groovy.lang.Closure)
lluppani commented 8 years ago

@chriswhite199 as I know that the code its using both, so I workaround it configuring both like this to enable ANCHORLINKS:

markdownToHtml.all = true
markdownToHtml.customizePegdown = { ALL | ANCHORLINKS }
markdownToHtml.customizeRemark = { ALL | ANCHORLINKS }

But I'm not using Remark at all.

Lucas.

aalmiray commented 4 years ago

Fixed