Removed URL parameter and updated MarkdownMacro.java to get URL from bodyContent.

This commit is contained in:
unknown
2018-08-08 16:06:31 -05:00
parent e3fa72d307
commit 8a4b73b7bd
3 changed files with 16 additions and 15 deletions

View File

@@ -90,6 +90,8 @@
<configuration>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
</configuration>
</plugin>
<plugin>

View File

@@ -105,14 +105,13 @@ public class MarkdownMacro extends BaseMacro implements Macro
" });\n" +
"</script>";
if (bodyContent != null) {
Parser parser = Parser.builder(options).build();
HtmlRenderer renderer = HtmlRenderer.builder(options).build();
String toParse = bodyContent;
if (parameters.get("URL") != null) {
String toParse = "";
try {
String urlParam = parameters.get("URL");
URL importFrom = new URL(urlParam);
URL importFrom = new URL(bodyContent);
BufferedReader in = new BufferedReader(
new InputStreamReader(importFrom.openStream())
);
@@ -124,10 +123,13 @@ public class MarkdownMacro extends BaseMacro implements Macro
in.close();
}
catch (IOException e) {}
}
Node document = parser.parse(toParse);
String html = renderer.render(document) + highlightjs;
return html;
}else {
return "";
}
}

View File

@@ -14,10 +14,7 @@
icon="/download/resources/com.atlassian.plugins.confluence.markdown.confluence-markdown-macro/images/pluginIcon.png"
documentation-url="https://spec.commonmark.org/0.28/">
<category name="formatting"/>
<parameters>
<parameter name="URL" type="string" />
</parameters>
</xhtml-macro>
<parameters />
<macro name="markdown"
class="com.atlassian.plugins.confluence.markdown.MarkdownMacro"
key="markdown.wiki"