Ejemplo n.º 1
0
 /// <summary>
 /// Gets a diff between the <see cref="MarkdownContent"/> of this item and the given one, as
 /// rendered HTML.
 /// </summary>
 /// <param name="options">An <see cref="IWikiOptions"/> instance.</param>
 /// <param name="dataStore">An <see cref="IDataStore"/> instance.</param>
 /// <param name="other">The other <see cref="MarkdownItem"/> insteance.</param>
 /// <returns>
 /// A string representing the diff between this instance and the <paramref name="other"/>
 /// instance, as rendered HTML.
 /// </returns>
 public string GetDiffHtml(IWikiOptions options, IDataStore dataStore, MarkdownItem other)
 => RenderHtml(options, dataStore, PostprocessMarkdown(options, dataStore, GetDiff(other, "html")));
Ejemplo n.º 2
0
 /// <summary>
 /// Gets a diff between the <see cref="MarkdownContent"/> of this item and the given one.
 /// </summary>
 /// <param name="other">The other <see cref="MarkdownItem"/> insteance.</param>
 /// <param name="format">
 /// <para>
 /// The format used.
 /// </para>
 /// <para>
 /// Can be either "delta" (the default), "gnu", "md", or "html" (case insensitive).
 /// </para>
 /// <para>
 /// The "delta" format (the default, used if an empty string or whitespace is passed)
 /// renders a compact, encoded string which describes each diff operation. The first
 /// character is '=' for unchanged text, '+' for an insertion, and '-' for deletion.
 /// Unchanged text and deletions are followed by their length only; insertions are followed
 /// by a compressed version of their full text. Each diff is separated by a tab character
 /// ('\t').
 /// </para>
 /// <para>
 /// The "gnu" format renders the text preceded by "- " for deletion, "+ " for addition, or
 /// nothing if the text was unchanged. Each diff is separated by a newline.
 /// </para>
 /// <para>
 /// The "md" format renders the text surrounded by "~~" for deletion, "++" for addition, or
 /// nothing if the text was unchanged. Diffs are concatenated without separators.
 /// </para>
 /// <para>
 /// The "html" format renders the text surrounded by a span with class "diff-deleted" for
 /// deletion, "diff-inserted" for addition, or without a wrapping span if the text was
 /// unchanged. Diffs are concatenated without separators.
 /// </para>
 /// </param>
 /// <returns>
 /// A string representing the diff between this instance and the <paramref name="other"/>
 /// instance.
 /// </returns>
 public string GetDiff(MarkdownItem other, string format = "md")
 => Diff.GetWordDiff(MarkdownContent, other.MarkdownContent).ToString(format);