Only see single lines

CodeHighlighter for ASP.NET Forum

Posted 17 years ago by Colin Bragg
Version: 4.0.49
Avatar
Hi I'm using vb.net and the problem that I am having is that the generated HTML code is only showing as one complete line and isnt showing seperate lines.

Here is code from some dummy app i was playing with before putting into my real app:
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim engine As New ActiproSoftware.CodeHighlighter.CodeHighlighterEngine
        Dim language As ActiproSoftware.SyntaxEditor.Addons.Dynamic.DynamicSyntaxLanguage
        language = ActiproSoftware.SyntaxEditor.Addons.Dynamic.DynamicSyntaxLanguage.LoadFromXml("C:/Documents and Settings/cbragg/Desktop/CodeHighlighter/Languages/Lexers/ActiproSoftware.VBDotNet.xml", 0)        
        Dim strCode As String = TextBox1.Text
        strCode = HttpUtility.HtmlEncode(strCode)        
        engine.OutliningImagesPath = "C:\Documents and Settings\cbragg\Desktop\CodeHighlighter\Images\OutliningIndicators\"
        engine.OutliningEnabled = True
        engine.SpacesInTabs = 4
        engine.LineNumberMarginVisible = True
        strCode = engine.GenerateHtmlInline("colin", strCode, language)                
        WebBrowser1.DocumentText = strCode
    End Sub
[Modified at 09/24/2007 08:31 AM]

Comments (3)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Colin,

Make sure you surround the CodeHighlighter control with a PRE tag block.


Actipro Software Support

Posted 17 years ago by Colin Bragg
Avatar
Sounds like that is the right line to go down to take into consideration the whitespacing. However..... My code as you can see is in a windows form so i can't (or dont know how to) use the PRE tag block. Check out the code that i posted earlier, it should make more sense

Thanks
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Well perhaps you could just put "<pre>" + strCode + "</pre>" and set that to the browser? Somehow you need the pre tags in there since browsers normalize lineend whitespace to spaces.


Actipro Software Support

The latest build of this product (v4.0.59) was released 13 years ago, which was after the last post in this thread.