public string Format(string Document, string HighlighterName, bool IncludeLineNumbers)
        {
            HtmlWriter writer = new HtmlWriter();
            writer.ShowLineNumbers = IncludeLineNumbers;
            writer.AlternateLineBackground = false;

            string generatedHtml = writer.GenerateHtml(Document, HighlighterName);
            return "<html><body>" + generatedHtml + "</body></html>";
        }
Exemplo n.º 2
0
		public static void Main(string[] args)
		{
			HtmlWriter w = new HtmlWriter();
			w.ShowLineNumbers = true;
			w.AlternateLineBackground = true;
			string code = File.ReadAllText("../../Main.cs");
			string html = w.GenerateHtml(code, "C#");
			File.WriteAllText("output.html", "<html><body>" + html + "</body></html>");
			Process.Start("output.html"); // view in browser
		}
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            HtmlWriter w = new HtmlWriter();

            w.ShowLineNumbers         = true;
            w.AlternateLineBackground = true;
            string code = File.ReadAllText("../../Main.cs");
            string html = w.GenerateHtml(code, "C#");

            File.WriteAllText("output.html", "<html><body>" + html + "</body></html>");
            Process.Start("output.html");             // view in browser
        }
Exemplo n.º 4
0
		public static void Main(string[] args)
		{
			IHighlightingDefinition highlightDefinition = HighlightingManager.Instance.GetDefinition("C#");
			
			HtmlWriter w = new HtmlWriter();
			w.ShowLineNumbers = true;
			w.AlternateLineBackground = true;
			string code = File.ReadAllText("../../Main.cs");
			string html = w.GenerateHtml(code, highlightDefinition);
			File.WriteAllText("output.html", "<html><body>" + html + "</body></html>");
			Process.Start("output.html"); // view in browser
		}
Exemplo n.º 5
0
        protected void formatCode_Click(object sender, EventArgs e)
        {
            HtmlWriter writer = new HtmlWriter();
            writer.ShowLineNumbers = ShowLineNumbers.Checked;
            writer.AlternateLineBackground = UseAlternatingBackground.Checked;

            string generatedHtml = writer.GenerateHtml(inputTextBox.Text, languageChoice.SelectedValue);

            string codeHtmlDocument = "<html><body>" + generatedHtml + "</body></html>";
            outputTextBox.Text = codeHtmlDocument;
            inlineCodePreview.Text = generatedHtml;
            PreviewPane.Visible = true;
        }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            IHighlightingDefinition highlightDefinition = HighlightingManager.Instance.GetDefinition("C#");

            HtmlWriter w = new HtmlWriter();

            w.ShowLineNumbers         = true;
            w.AlternateLineBackground = true;
            string code = File.ReadAllText("../../Main.cs");
            string html = w.GenerateHtml(code, highlightDefinition);

            File.WriteAllText("output.html", "<html><body>" + html + "</body></html>");
            Process.Start("output.html");             // view in browser
        }
Exemplo n.º 7
0
        public static void Main(string[] args)
        {
            IHighlightingDefinition highlightDefinition = null;
            var _assembly = Assembly.GetExecutingAssembly();
            using (Stream s = File.OpenRead("GherkinDefinition.xshd"))
            {
                using (XmlTextReader reader = new XmlTextReader(s))
                {
                    highlightDefinition = HighlightingLoader.Load(reader, HighlightingManager.Instance);
                }
            }

            HtmlWriter w = new HtmlWriter();
            w.ShowLineNumbers = false;
            w.CreateStylesheet = false;
            w.AlternateLineBackground = false;
            string code = File.ReadAllText("../../SampleFeature.txt");
            string html = w.GenerateHtml(code, highlightDefinition);
            File.WriteAllText("output.html", "<html><body>" + html + "</body></html>");
            Process.Start("output.html"); // view in browser
        }