/// <summary> /// Renders the wiki content using the specified macros and custom formatter. /// </summary> /// <param name="wikiContent">The wiki content to be rendered.</param> /// <param name="macros">A collection of macros to be used when rendering.</param> /// <param name="formatter">The custom formatter used when rendering.</param> /// <returns>The rendered html content.</returns> /// <exception cref="System.ArgumentNullException"> /// <para>Thrown when macros is null.</para> /// <para>- or -</para> /// <para>Thrown when formatter is null.</para> /// </exception> /// <exception cref="System.ArgumentException">Thrown when macros is an empty enumerable.</exception> public string Render(string wikiContent, IEnumerable<IMacro> macros, Formatter formatter) { Guard.NotNullOrEmpty(macros, "macros"); Guard.NotNull(formatter, "formatter"); if (string.IsNullOrEmpty(wikiContent)) return wikiContent; wikiContent = wikiContent.Replace("\r\n", "\n"); parser.Parse(wikiContent, macros, ScopeAugmenters.All, formatter.RecordParse); return ReplaceNewLines(formatter.Format(wikiContent)); }
/// <summary> /// Renders the wiki content using the a custom formatter with statically registered macros. /// </summary> /// <param name="wikiContent">The wiki content to be rendered.</param> /// <param name="formatter">The custom formatter used when rendering.</param> /// <returns>The rendered html content.</returns> /// <exception cref="System.ArgumentNullException">Thrown when formatter is null.</exception> public string Render(string wikiContent, Formatter formatter) { return Render(wikiContent, Macros.All, formatter); }
/// <summary> /// Renders the wiki content using the specified macros and renderers. /// </summary> /// <param name="wikiContent">The wiki content to be rendered.</param> /// <param name="macros">A collection of macros to be used when rendering.</param> /// <param name="renderers">A collection of renderers to be used when rendering.</param> /// <returns>The rendered html content.</returns> public string Render(string wikiContent, IEnumerable<IMacro> macros, IEnumerable<IRenderer> renderers) { Guard.NotNullOrEmpty(renderers, "renderers"); var formatter = new Formatter(renderers); return Render(wikiContent, macros, formatter); }