public static CreateHtmlFragment ( |
||
document | The document to create HTML from. | |
highlighter | The highlighter used to highlight the document. | |
segment | ISegment | The part of the document to create HTML for. You can pass null to create HTML for the whole document. |
options | The options for the HTML creation. | |
return | string |
public void PartOfHighlightedWordTest() { var segment = new TextSegment { StartOffset = 1, Length = 3 }; string html = HtmlClipboard.CreateHtmlFragment(document, highlighter, segment, new HtmlOptions()); Assert.AreEqual("<span style=\"color: #008000; font-weight: bold; \">sin</span>", html); }
public void FullDocumentTest() { var segment = new TextSegment { StartOffset = 0, Length = document.TextLength }; string html = HtmlClipboard.CreateHtmlFragment(document, highlighter, segment, new HtmlOptions()); Assert.AreEqual("<span style=\"color: #008000; font-weight: bold; \">using</span> " + "System<span style=\"color: #006400; \">.</span>Text<span style=\"color: #006400; \">;</span><br>" + Environment.NewLine + " <span style=\"color: #ff0000; \">string</span> " + "text = <span style=\"color: #191970; font-weight: bold; \">SomeMethod</span><span style=\"color: #006400; \">();</span>", html); }