public MarkdownService() { _ctx = new JSContext(_vm); var script = System.IO.File.ReadAllText("WebResources/marked.js", System.Text.Encoding.UTF8); _ctx.EvaluateScript(script); _val = _ctx[new NSString("marked")]; }
public MarkdownService() { var scriptPath = System.IO.Path.Combine(NSBundle.MainBundle.BundlePath, "WebResources", "marked.js"); var scriptContents = System.IO.File.ReadAllText(scriptPath); _ctx = new JSContext(_vm); _ctx.EvaluateScript(scriptContents); _val = _ctx[new NSString("marked")]; }
public string ConvertMarkdown(string c) { if (string.IsNullOrEmpty(c)) return string.Empty; using (var vm = new JSVirtualMachine()) { var ctx = new JSContext(vm); var script = System.IO.File.ReadAllText("Markdown/marked.js", System.Text.Encoding.UTF8); ctx.EvaluateScript(script); var val = ctx[new NSString("marked")]; return val.Call(JSValue.From(c, ctx)).ToString(); } }