diff --git a/source/Plugins/AyaNova.Plugin.V8/AyaNova.Plugin.V8.csproj b/source/Plugins/AyaNova.Plugin.V8/AyaNova.Plugin.V8.csproj
index eb65fa7..49e8c79 100644
--- a/source/Plugins/AyaNova.Plugin.V8/AyaNova.Plugin.V8.csproj
+++ b/source/Plugins/AyaNova.Plugin.V8/AyaNova.Plugin.V8.csproj
@@ -39,9 +39,16 @@
AyaNova.snk
+
+ False
+ libs\HtmlAgilityPack.dll
+
..\..\..\3rdprtylibs\json.net.40\Newtonsoft.Json.dll
+
+ libs\ReverseMarkdown.dll
+
diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs
index dfbe217..1dcb262 100644
--- a/source/Plugins/AyaNova.Plugin.V8/V8.cs
+++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs
@@ -15,6 +15,8 @@ using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
+//using HtmlAgilityPack;
+//using ReverseMarkdown;
namespace AyaNova.PlugIn.V8
@@ -746,6 +748,7 @@ namespace AyaNova.PlugIn.V8
WikiPage w = WikiPage.GetItem(tid);
var content = w.GetContentAsString;
+ if (string.IsNullOrWhiteSpace(content)) return null;
//TODO: fixup internal urls using MAP of file attachment uploads
@@ -756,12 +759,31 @@ namespace AyaNova.PlugIn.V8
content = content.Replace(m.Value, "
");
}
- //TODO: Convert to Markdown format
+ //todo: fixup font size, try to convert to heading tags instead
- if (!string.IsNullOrWhiteSpace(content))
- return content;
- else
- return null;
+ //TODO: Convert to Markdown format
+ //found 2 likely candidate libs to do this
+ //https://www.nuget.org/packages/Html2Markdown/
+ //https://www.nuget.org/packages/ReverseMarkdown/
+
+ //Not much difference at first glance, very similar stats, reverse markdown is a little more widely used and seems to have more config options
+ //built in, the other has to make some kind of processor for some stuff maybe so going with reverse for now
+
+ //NOTE: for this to work had to add an assembly redirect in app.config for ayanova project as it was looking for a really old version of
+ //the HtmlAgilityPack
+
+ var config = new ReverseMarkdown.Config
+ {
+ UnknownTags = ReverseMarkdown.Config.UnknownTagsOption.Bypass,
+ GithubFlavored = true, // generate GitHub flavoured markdown, supported for BR, PRE and table tags
+ RemoveComments = true, // will ignore all comments
+ SmartHrefHandling = true // remove markdown output for links where appropriate
+ };
+
+ var converter = new ReverseMarkdown.Converter(config);
+ string res = converter.Convert(content);
+
+ return res;
}
diff --git a/source/Plugins/AyaNova.Plugin.V8/libs/HtmlAgilityPack.dll b/source/Plugins/AyaNova.Plugin.V8/libs/HtmlAgilityPack.dll
new file mode 100644
index 0000000..5104bbf
Binary files /dev/null and b/source/Plugins/AyaNova.Plugin.V8/libs/HtmlAgilityPack.dll differ
diff --git a/source/Plugins/AyaNova.Plugin.V8/libs/ReverseMarkdown.dll b/source/Plugins/AyaNova.Plugin.V8/libs/ReverseMarkdown.dll
new file mode 100644
index 0000000..d98944f
Binary files /dev/null and b/source/Plugins/AyaNova.Plugin.V8/libs/ReverseMarkdown.dll differ