コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeColorizerBase"/> class for creating Syntax Highlighted code.
        /// </summary>
        /// <param name="styles">The Custom styles to Apply to the formatted Code.</param>
        /// <param name="languageParser">The language parser that the <see cref="CodeColorizerBase"/> instance will use for its lifetime.</param>
        public CodeColorizerBase(StyleDictionary styles, ILanguageParser languageParser)
        {
            LanguageParser = languageParser
                             ?? new LanguageParser(new LanguageCompiler(Languages.CompiledLanguages), Languages.LanguageRepository);

            Styles = styles ?? StyleDictionary.DefaultLight;
        }
コード例 #2
0
 public CustomHorizontalBarFactory(TextFormat textFormat, string nodeName = "td")
 {
     _textFormat = textFormat;
     _nodeName   = nodeName;
     Styles      = new StyleDictionary();
     Classes     = new List <string>();
 }
コード例 #3
0
        public CodeHighlighter()
        {
            StyleDictionary style = StyleDictionary.DefaultLight;

            style[ScopeName.PlainText].Background = "";
            Formatter = new HtmlFormatter(style);
        }
コード例 #4
0
 public static MarkdownPipelineBuilder UseSyntaxHighlighting(
     this MarkdownPipelineBuilder pipeline,
     StyleDictionary style,
     bool inlineCss)
 {
     pipeline.Extensions.Add(new SyntaxHighlightingExtension(style, inlineCss));
     return(pipeline);
 }
コード例 #5
0
        /// <summary>
        /// Gets the style for the specified key.
        /// </summary>
        public static GUIStyle GetStyle(string key)
        {
            GUIStyle style;

            if (!StyleDictionary.TryGetValue(key, out style))
            {
                style = GUIStyle.none;
            }
            return(style);
        }
コード例 #6
0
        private async void MakeHTML(StyleDictionary Styles)
        {
            var result = await GetCodeFileText();

            if (result == null)
            {
                return;
            }

            var formatter = new HtmlFormatter(Styles);
            var html      = formatter.GetHtmlString(result.Item1, result.Item2);

            var tempfile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("HTMLResult.html", CreationCollisionOption.ReplaceExisting);

            await FileIO.WriteTextAsync(tempfile, html);

            try
            {
                await Launcher.LaunchFileAsync(tempfile);
            }
            catch { }
        }
コード例 #7
0
 static DefaultStyleSheet()
 {
     styles = new StyleDictionary
     {
         new Style(ScopeName.PlainText)
         {
             Foreground = Color.Black,
             Background = Color.White
         },
         new Style(ScopeName.HtmlServerSideScript)
         {
             Background = Color.Yellow
         },
         new Style(ScopeName.HtmlComment)
         {
             Foreground = Color.Green
         },
         new Style(ScopeName.HtmlTagDelimiter)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.HtmlElementName)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.HtmlAttributeName)
         {
             Foreground = Color.Red
         },
         new Style(ScopeName.HtmlAttributeValue)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.HtmlOperator)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.Comment)
         {
             Foreground = Color.Green
         },
         new Style(ScopeName.XmlDocTag)
         {
             Foreground = Color.Gray
         },
         new Style(ScopeName.XmlDocComment)
         {
             Foreground = Color.Green
         },
         new Style(ScopeName.String)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.StringCSharpVerbatim)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.Keyword)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.PreprocessorKeyword)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.HtmlEntity)
         {
             Foreground = Color.Red
         },
         new Style(ScopeName.XmlAttribute)
         {
             Foreground = Color.Red
         },
         new Style(ScopeName.XmlAttributeQuotes)
         {
             Foreground = Color.Black
         },
         new Style(ScopeName.XmlAttributeValue)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.XmlCDataSection)
         {
             Foreground = Color.Gray
         },
         new Style(ScopeName.XmlComment)
         {
             Foreground = Color.Green
         },
         new Style(ScopeName.XmlDelimiter)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.XmlName)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.ClassName)
         {
             Foreground = Color.MediumTurquoise
         },
         new Style(ScopeName.CssSelector)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.CssPropertyName)
         {
             Foreground = Color.Red
         },
         new Style(ScopeName.CssPropertyValue)
         {
             Foreground = Color.Blue
         },
         new Style(ScopeName.SqlSystemFunction)
         {
             Foreground = Color.Magenta
         },
         new Style(ScopeName.PowerShellAttribute)
         {
             Foreground = Color.PowderBlue
         },
         new Style(ScopeName.PowerShellOperator)
         {
             Foreground = Color.Gray
         },
         new Style(ScopeName.PowerShellType)
         {
             Foreground = Color.Teal
         },
         new Style(ScopeName.PowerShellVariable)
         {
             Foreground = Color.OrangeRed
         }
     };
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RichTextBlockFormatter"/> class for rendering Syntax Highlighted code to a RichTextBlock.
 /// </summary>
 /// <param name="style">The Custom styles to Apply to the formatted Code.</param>
 /// <param name="languageParser">The language parser that the <see cref="RichTextBlockFormatter"/> instance will use for its lifetime.</param>
 public RichTextBlockFormatter(StyleDictionary style = null, ILanguageParser languageParser = null) : base(style, languageParser)
 {
 }
コード例 #9
0
 static DefaultStyleSheet()
 {
     styles = new StyleDictionary
                  {
                      new Style(ScopeName.PlainText)
                          {
                              Foreground = Color.Black,
                              Background = Color.White,
                              CssClassName = "plainText"
                          },
                      new Style(ScopeName.HtmlServerSideScript)
                          {
                              Background = Color.Yellow,
                              CssClassName = "htmlServerSideScript"
                          },
                      new Style(ScopeName.HtmlComment)
                          {
                              Foreground = Color.Green,
                              CssClassName = "htmlComment"
                          },
                      new Style(ScopeName.HtmlTagDelimiter)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "htmlTagDelimiter"
                          },
                      new Style(ScopeName.HtmlElementName)
                          {
                              Foreground = DullRed,
                              CssClassName = "htmlElementName"
                          },
                      new Style(ScopeName.HtmlAttributeName)
                          {
                              Foreground = Color.Red,
                              CssClassName = "htmlAttributeName"
                          },
                      new Style(ScopeName.HtmlAttributeValue)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "htmlAttributeValue"
                          },
                      new Style(ScopeName.HtmlOperator)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "htmlOperator"
                          },
                      new Style(ScopeName.Comment)
                          {
                              Foreground = Color.Green,
                              CssClassName = "comment"
                          },
                      new Style(ScopeName.XmlDocTag)
                          {
                              Foreground = Color.Gray,
                              CssClassName = "xmlDocTag"
                          },
                      new Style(ScopeName.XmlDocComment)
                          {
                              Foreground = Color.Green,
                              CssClassName = "xmlDocComment"
                          },
                      new Style(ScopeName.String)
                          {
                              Foreground = DullRed,
                              CssClassName = "string"
                          },
                      new Style(ScopeName.StringCSharpVerbatim)
                          {
                              Foreground = DullRed,
                              CssClassName = "stringCSharpVerbatim"
                          },
                      new Style(ScopeName.Keyword)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "keyword"
                          },
                      new Style(ScopeName.PreprocessorKeyword)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "preprocessorKeyword"
                          },
                      new Style(ScopeName.HtmlEntity)
                          {
                              Foreground = Color.Red,
                              CssClassName = "htmlEntity"
                          },
                      new Style(ScopeName.XmlAttribute)
                          {
                              Foreground = Color.Red,
                              CssClassName = "xmlAttribute"
                          },
                      new Style(ScopeName.XmlAttributeQuotes)
                          {
                              Foreground = Color.Black,
                              CssClassName = "xmlAttributeQuotes"
                          },
                      new Style(ScopeName.XmlAttributeValue)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "xmlAttributeValue"
                          },
                      new Style(ScopeName.XmlCDataSection)
                          {
                              Foreground = Color.Gray,
                              CssClassName = "xmlCDataSection"
                          },
                      new Style(ScopeName.XmlComment)
                          {
                              Foreground = Color.Green,
                              CssClassName = "xmlComment"
                          },
                      new Style(ScopeName.XmlDelimiter)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "xmlDelimiter"
                          },
                      new Style(ScopeName.XmlName)
                          {
                              Foreground = DullRed,
                              CssClassName = "xmlName"
                          },
                      new Style(ScopeName.ClassName)
                          {
                              Foreground = Color.MediumTurquoise,
                              CssClassName = "className"
                          },
                      new Style(ScopeName.CssSelector)
                          {
                              Foreground = DullRed,
                              CssClassName = "cssSelector"
                          },
                      new Style(ScopeName.CssPropertyName)
                          {
                              Foreground = Color.Red,
                              CssClassName = "cssPropertyName"
                          },
                      new Style(ScopeName.CssPropertyValue)
                          {
                              Foreground = Color.Blue,
                              CssClassName = "cssPropertyValue"
                          },
                      new Style(ScopeName.SqlSystemFunction)
                          {
                              Foreground = Color.Magenta,
                              CssClassName = "sqlSystemFunction"
                          },
                      new Style(ScopeName.PowerShellAttribute)
                          {
                              Foreground = Color.PowderBlue,
                              CssClassName = "powershellAttribute"
                          },
                      new Style(ScopeName.PowerShellOperator)
                          {
                              Foreground = Color.Gray,
                              CssClassName = "powershellOperator"
                          },
                      new Style(ScopeName.PowerShellType)
                          {
                              Foreground = Color.Teal,
                              CssClassName = "powershellType"
                          },
                      new Style(ScopeName.PowerShellVariable)
                          {
                              Foreground = Color.OrangeRed,
                              CssClassName = "powershellVariable"
                          }
                  };
 }
コード例 #10
0
 /// <summary>
 /// Creates a <see cref="CodeBlockFormatter"/>, for rendering Syntax Highlighted code to a FlowDocument.
 /// </summary>
 /// <param name="Style">The Custom styles to Apply to the formatted Code.</param>
 /// <param name="languageParser">The language parser that the <see cref="CodeBlockFormatter"/> instance will use for its lifetime.</param>
 public CodeBlockFormatter(StyleDictionary Style = null, ILanguageParser languageParser = null) : base(Style, languageParser)
 {
 }
コード例 #11
0
ファイル: CellFactoryBase.cs プロジェクト: radtek/Omi
        //public StyleDictionary Styles { get; set; }
        //public IList<string> Classes { get; set; }

        public CellFactoryBase(string nodeName = "td")
        {
            NodeName = nodeName;
            Styles   = new StyleDictionary();
            Classes  = new List <string>();
        }
コード例 #12
0
        static DefaultStyleSheet()
        {
            styles = new StyleDictionary
                         {
                             new Style(ScopeName.PlainText)
                                 {
                                     Foreground = Color.Black,
                                     Background = Color.White,
                                     CssClassName = "plainText"
                                 },
                             new Style(ScopeName.HtmlServerSideScript)
                                 {
                                     Background = Color.Yellow,
                                     CssClassName = "htmlServerSideScript"
                                 },
                             new Style(ScopeName.HtmlComment)
                                 {
                                     Foreground = Color.Green,
                                     CssClassName = "htmlComment"
                                 },
                             new Style(ScopeName.HtmlTagDelimiter)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "htmlTagDelimiter"
                                 },
                             new Style(ScopeName.HtmlElementName)
                                 {
                                     Foreground = DullRed,
                                     CssClassName = "htmlElementName"
                                 },
                             new Style(ScopeName.HtmlAttributeName)
                                 {
                                     Foreground = Color.Red,
                                     CssClassName = "htmlAttributeName"
                                 },
                             new Style(ScopeName.HtmlAttributeValue)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "htmlAttributeValue"
                                 },
                             new Style(ScopeName.HtmlOperator)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "htmlOperator"
                                 },
                             new Style(ScopeName.Comment)
                                 {
                                     Foreground = Color.Green,
                                     CssClassName = "comment"
                                 },
                             new Style(ScopeName.XmlDocTag)
                                 {
                                     Foreground = Color.Gray,
                                     CssClassName = "xmlDocTag"
                                 },
                             new Style(ScopeName.XmlDocComment)
                                 {
                                     Foreground = Color.Green,
                                     CssClassName = "xmlDocComment"
                                 },
                             new Style(ScopeName.String)
                                 {
                                     Foreground = DullRed,
                                     CssClassName = "string"
                                 },
                             new Style(ScopeName.StringCSharpVerbatim)
                                 {
                                     Foreground = DullRed,
                                     CssClassName = "stringCSharpVerbatim"
                                 },
                             new Style(ScopeName.Keyword)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "keyword"
                                 },
                             new Style(ScopeName.PreprocessorKeyword)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "preprocessorKeyword"
                                 },
                             new Style(ScopeName.HtmlEntity)
                                 {
                                     Foreground = Color.Red,
                                     CssClassName = "htmlEntity"
                                 },
                             new Style(ScopeName.XmlAttribute)
                                 {
                                     Foreground = Color.Red,
                                     CssClassName = "xmlAttribute"
                                 },
                             new Style(ScopeName.XmlAttributeQuotes)
                                 {
                                     Foreground = Color.Black,
                                     CssClassName = "xmlAttributeQuotes"
                                 },
                             new Style(ScopeName.XmlAttributeValue)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "xmlAttributeValue"
                                 },
                             new Style(ScopeName.XmlCDataSection)
                                 {
                                     Foreground = Color.Gray,
                                     CssClassName = "xmlCDataSection"
                                 },
                             new Style(ScopeName.XmlComment)
                                 {
                                     Foreground = Color.Green,
                                     CssClassName = "xmlComment"
                                 },
                             new Style(ScopeName.XmlDelimiter)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "xmlDelimiter"
                                 },
                             new Style(ScopeName.XmlName)
                                 {
                                     Foreground = DullRed,
                                     CssClassName = "xmlName"
                                 },
                             new Style(ScopeName.ClassName)
                                 {
                                     Foreground = Color.MediumTurquoise,
                                     CssClassName = "className"
                                 },
                             new Style(ScopeName.CssSelector)
                                 {
                                     Foreground = DullRed,
                                     CssClassName = "cssSelector"
                                 },
                             new Style(ScopeName.CssPropertyName)
                                 {
                                     Foreground = Color.Red,
                                     CssClassName = "cssPropertyName"
                                 },
                             new Style(ScopeName.CssPropertyValue)
                                 {
                                     Foreground = Color.Blue,
                                     CssClassName = "cssPropertyValue"
                                 },
                             new Style(ScopeName.SqlSystemFunction)
                                 {
                                     Foreground = Color.Magenta,
                                     CssClassName = "sqlSystemFunction"
                                 },
                             new Style(ScopeName.PowerShellAttribute)
                                 {
                                     Foreground = Color.PowderBlue,
                                     CssClassName = "powershellAttribute"
                                 },
                             new Style(ScopeName.PowerShellOperator)
                                 {
                                     Foreground = Color.Gray,
                                     CssClassName = "powershellOperator"
                                 },
                             new Style(ScopeName.PowerShellType)
                                 {
                                     Foreground = Color.Teal,
                                     CssClassName = "powershellType"
                                 },
                             new Style(ScopeName.PowerShellVariable)
                                 {
                                     Foreground = Color.OrangeRed,
                                     CssClassName = "powershellVariable"
                                 },

                             new Style(ScopeName.Type)
                                {
                                    Foreground = Color.Teal,
                                    CssClassName = "type"
                                },
                             new Style(ScopeName.TypeVariable)
                                {
                                    Foreground = Color.Teal,
                                    Italic = true,
                                    CssClassName = "typeVariable"
                                },
                             new Style(ScopeName.NameSpace)
                                {
                                    Foreground = Color.Navy,
                                    CssClassName = "namespace"
                                },
                             new Style(ScopeName.Constructor)
                                {
                                    Foreground = Color.Purple,
                                    CssClassName = "constructor"
                                },
                             new Style(ScopeName.Predefined)
                                {
                                    Foreground = Color.Navy,
                                    CssClassName = "predefined"
                                },
                             new Style(ScopeName.PseudoKeyword)
                                {
                                    Foreground = Color.Navy,
                                    CssClassName = "pseudoKeyword"
                                },
                             new Style(ScopeName.StringEscape)
                                {
                                    Foreground = Color.Gray,
                                    CssClassName = "stringEscape"
                                },
                             new Style(ScopeName.ControlKeyword)
                                {
                                    Foreground = Color.Blue,
                                    CssClassName = "controlKeyword"
                                },
                             new Style(ScopeName.Number)
                                {
                                    CssClassName = "number"
                                },
                             new Style(ScopeName.Operator)
                                {
                                    CssClassName = "operator"
                                },
                             new Style(ScopeName.Delimiter)
                                {
                                    CssClassName = "delimiter"
                                },

                             new Style(ScopeName.MarkdownHeader)
                                {
                                    // Foreground = Color.Bluelue,
                                    Bold = true,
                                    CssClassName = "markdownHeader"
                                },
                             new Style(ScopeName.MarkdownCode)
                                {
                                    Foreground = Color.Teal,
                                    CssClassName = "markdownCode"
                                },
                             new Style(ScopeName.MarkdownListItem)
                                {
                                    Bold = true,
                                    CssClassName = "markdownListItem"
                                },
                             new Style(ScopeName.MarkdownEmph)
                                {
                                    Italic = true,
                                    CssClassName = "italic"
                                },
                             new Style(ScopeName.MarkdownBold)
                                {
                                    Bold = true,
                                    CssClassName = "bold"
                                },
                         };
        }
コード例 #13
0
 public SyntaxHighlightingExtension(StyleDictionary styles, bool inlineCss)
 {
     this.style     = styles;
     this.inlineCss = inlineCss;
 }
コード例 #14
0
        static DefaultStyleSheet()
        {
            styles = new StyleDictionary
            {
                new Style(ScopeName.PlainText)
                {
                    Foreground   = Color.Black,
                    Background   = Color.White,
                    CssClassName = "plainText"
                },
                new Style(ScopeName.HtmlServerSideScript)
                {
                    Background   = Color.Yellow,
                    CssClassName = "htmlServerSideScript"
                },
                new Style(ScopeName.HtmlComment)
                {
                    Foreground   = Color.Green,
                    CssClassName = "htmlComment"
                },
                new Style(ScopeName.HtmlTagDelimiter)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "htmlTagDelimiter"
                },
                new Style(ScopeName.HtmlElementName)
                {
                    Foreground   = DullRed,
                    CssClassName = "htmlElementName"
                },
                new Style(ScopeName.HtmlAttributeName)
                {
                    Foreground   = Color.Red,
                    CssClassName = "htmlAttributeName"
                },
                new Style(ScopeName.HtmlAttributeValue)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "htmlAttributeValue"
                },
                new Style(ScopeName.HtmlOperator)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "htmlOperator"
                },
                new Style(ScopeName.Comment)
                {
                    Foreground   = Color.Green,
                    CssClassName = "comment"
                },
                new Style(ScopeName.XmlDocTag)
                {
                    Foreground   = Color.Gray,
                    CssClassName = "xmlDocTag"
                },
                new Style(ScopeName.XmlDocComment)
                {
                    Foreground   = Color.Green,
                    CssClassName = "xmlDocComment"
                },
                new Style(ScopeName.String)
                {
                    Foreground   = DullRed,
                    CssClassName = "string"
                },
                new Style(ScopeName.StringCSharpVerbatim)
                {
                    Foreground   = DullRed,
                    CssClassName = "stringCSharpVerbatim"
                },
                new Style(ScopeName.Keyword)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "keyword"
                },
                new Style(ScopeName.PreprocessorKeyword)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "preprocessorKeyword"
                },
                new Style(ScopeName.HtmlEntity)
                {
                    Foreground   = Color.Red,
                    CssClassName = "htmlEntity"
                },
                new Style(ScopeName.XmlAttribute)
                {
                    Foreground   = Color.Red,
                    CssClassName = "xmlAttribute"
                },
                new Style(ScopeName.XmlAttributeQuotes)
                {
                    Foreground   = Color.Black,
                    CssClassName = "xmlAttributeQuotes"
                },
                new Style(ScopeName.XmlAttributeValue)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "xmlAttributeValue"
                },
                new Style(ScopeName.XmlCDataSection)
                {
                    Foreground   = Color.Gray,
                    CssClassName = "xmlCDataSection"
                },
                new Style(ScopeName.XmlComment)
                {
                    Foreground   = Color.Green,
                    CssClassName = "xmlComment"
                },
                new Style(ScopeName.XmlDelimiter)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "xmlDelimiter"
                },
                new Style(ScopeName.XmlName)
                {
                    Foreground   = DullRed,
                    CssClassName = "xmlName"
                },
                new Style(ScopeName.ClassName)
                {
                    Foreground   = Color.MediumTurquoise,
                    CssClassName = "className"
                },
                new Style(ScopeName.CssSelector)
                {
                    Foreground   = DullRed,
                    CssClassName = "cssSelector"
                },
                new Style(ScopeName.CssPropertyName)
                {
                    Foreground   = Color.Red,
                    CssClassName = "cssPropertyName"
                },
                new Style(ScopeName.CssPropertyValue)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "cssPropertyValue"
                },
                new Style(ScopeName.SqlSystemFunction)
                {
                    Foreground   = Color.Magenta,
                    CssClassName = "sqlSystemFunction"
                },
                new Style(ScopeName.PowerShellAttribute)
                {
                    Foreground   = Color.PowderBlue,
                    CssClassName = "powershellAttribute"
                },
                new Style(ScopeName.PowerShellOperator)
                {
                    Foreground   = Color.Gray,
                    CssClassName = "powershellOperator"
                },
                new Style(ScopeName.PowerShellType)
                {
                    Foreground   = Color.Teal,
                    CssClassName = "powershellType"
                },
                new Style(ScopeName.PowerShellVariable)
                {
                    Foreground   = Color.OrangeRed,
                    CssClassName = "powershellVariable"
                },

                new Style(ScopeName.Type)
                {
                    Foreground   = Color.Teal,
                    CssClassName = "type"
                },
                new Style(ScopeName.TypeVariable)
                {
                    Foreground   = Color.Teal,
                    Italic       = true,
                    CssClassName = "typeVariable"
                },
                new Style(ScopeName.NameSpace)
                {
                    Foreground   = Color.Navy,
                    CssClassName = "namespace"
                },
                new Style(ScopeName.Constructor)
                {
                    Foreground   = Color.Purple,
                    CssClassName = "constructor"
                },
                new Style(ScopeName.Predefined)
                {
                    Foreground   = Color.Navy,
                    CssClassName = "predefined"
                },
                new Style(ScopeName.PseudoKeyword)
                {
                    Foreground   = Color.Navy,
                    CssClassName = "pseudoKeyword"
                },
                new Style(ScopeName.StringEscape)
                {
                    Foreground   = Color.Gray,
                    CssClassName = "stringEscape"
                },
                new Style(ScopeName.ControlKeyword)
                {
                    Foreground   = Color.Blue,
                    CssClassName = "controlKeyword"
                },
                new Style(ScopeName.Number)
                {
                    CssClassName = "number"
                },
                new Style(ScopeName.Operator)
                {
                    CssClassName = "operator"
                },
                new Style(ScopeName.Delimiter)
                {
                    CssClassName = "delimiter"
                },

                new Style(ScopeName.MarkdownHeader)
                {
                    // Foreground = Color.Bluelue,
                    Bold         = true,
                    CssClassName = "markdownHeader"
                },
                new Style(ScopeName.MarkdownCode)
                {
                    Foreground   = Color.Teal,
                    CssClassName = "markdownCode"
                },
                new Style(ScopeName.MarkdownListItem)
                {
                    Bold         = true,
                    CssClassName = "markdownListItem"
                },
                new Style(ScopeName.MarkdownEmph)
                {
                    Italic       = true,
                    CssClassName = "italic"
                },
                new Style(ScopeName.MarkdownBold)
                {
                    Bold         = true,
                    CssClassName = "bold"
                },
            };
        }
コード例 #15
0
 public HighlightedCodeBlockRenderer(StyleDictionary style, bool inlineCss)
     : base()
 {
     this.style     = style;
     this.inlineCss = inlineCss;
 }
コード例 #16
0
 public BlankTableCellFactory()
 {
     Styles = new StyleDictionary();
 }
コード例 #17
0
 public ValueIndicatingArrowFactory()
 {
     Styles = new StyleDictionary();
 }
コード例 #18
0
 public HyperLinkCellFactory(string nodeName = "td")
 {
     _nodeName = nodeName;
     Styles    = new StyleDictionary();
     Classes   = new List <string>();
 }
コード例 #19
0
        /// <summary>
        /// Creates a <see cref="RichTextBlockFormatter"/>, for rendering Syntax Highlighted code to a RichTextBlock.
        /// </summary>
        /// <param name="style">The Custom styles to Apply to the formatted Code.</param>
        /// <param name="languageParser">The language parser that the <see cref="RichTextBlockFormatter"/> instance will use for its lifetime.</param>
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.

        public RichTextBlockFormatter(StyleDictionary style, ILanguageParser?languageParser = null) : base(style, languageParser)
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        {
        }
コード例 #20
0
 static VS2013DarkStyleSheet()
 {
     styles = new StyleDictionary
     {
         new Style(ScopeName.PlainText)
         {
             Foreground = Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6),
             Background = Color.FromArgb(0xFF, 0x1C, 0x1c, 0x1C),
         },
         new Style(ScopeName.HtmlServerSideScript)
         {
             Background = Colors.Yellow
         },
         new Style(ScopeName.HtmlComment)
         {
             Foreground = Colors.Green
         },
         new Style(ScopeName.HtmlTagDelimiter)
         {
             Foreground = Colors.Blue
         },
         new Style(ScopeName.HtmlElementName)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.HtmlAttributeName)
         {
             Foreground = Colors.Red
         },
         new Style(ScopeName.HtmlAttributeValue)
         {
             Foreground = Colors.Blue
         },
         new Style(ScopeName.HtmlOperator)
         {
             Foreground = Colors.Blue
         },
         new Style(ScopeName.Comment)
         {
             Foreground = Color.FromArgb(0xFF, 0x3D, 0xa6, 0x3F)
         },
         new Style(ScopeName.XmlDocTag)
         {
             Foreground = Colors.Gray
         },
         new Style(ScopeName.XmlDocComment)
         {
             Foreground = Color.FromArgb(0xFF, 0x3D, 0xa6, 0x3F)
         },
         new Style(ScopeName.String)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.StringCSharpVerbatim)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.Keyword)
         {
             Foreground = Color.FromArgb(0xFF, 0x23, 0x61, 0xB9),
         },
         new Style(ScopeName.PreprocessorKeyword)
         {
             Foreground = Color.FromArgb(0xFF, 0x23, 0x61, 0xB9),
         },
         new Style(ScopeName.HtmlEntity)
         {
             Foreground = Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6)
         },
         new Style(ScopeName.XmlAttribute)
         {
             Foreground = Color.FromArgb(0xFF, 0x89, 0xCA, 0xDA)
         },
         new Style(ScopeName.XmlAttributeQuotes)
         {
             Foreground = Color.FromArgb(0xFF, 0x59, 0x9C, 0xD6)
         },
         new Style(ScopeName.XmlAttributeValue)
         {
             Foreground = Color.FromArgb(0xFF, 0x59, 0x9C, 0xD6)
         },
         new Style(ScopeName.XmlCDataSection)
         {
             Foreground = Colors.Gray
         },
         new Style(ScopeName.XmlComment)
         {
             Foreground = Colors.Green
         },
         new Style(ScopeName.XmlDelimiter)
         {
             Foreground = Color.FromArgb(0xFF, 0x80, 0x80, 0x80)
         },
         new Style(ScopeName.XmlName)
         {
             Foreground = Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6)
         },
         new Style(ScopeName.ClassName)
         {
             Foreground = Color.FromArgb(0xFF, 0x4E, 0xC9, 0xB0)
         },
         new Style(ScopeName.CssSelector)
         {
             Foreground = DullRed
         },
         new Style(ScopeName.CssPropertyName)
         {
             Foreground = Colors.Red
         },
         new Style(ScopeName.CssPropertyValue)
         {
             Foreground = Colors.Blue
         },
         new Style(ScopeName.SqlSystemFunction)
         {
             Foreground = Colors.Magenta
         },
     };
 }
コード例 #21
0
 public static MarkdownPipelineBuilder UseSyntaxHighlighting(this MarkdownPipelineBuilder pipeline, StyleDictionary customCss = null)
 {
     pipeline.Extensions.Add(new SyntaxHighlightingExtension());
     return(pipeline);
 }
コード例 #22
0
 public DiffViewTextColorizer(StyleDictionary Style = null, ILanguageParser languageParser = null)
     : base(Style, languageParser)
 {
 }
コード例 #23
0
ファイル: ColorfulDivCellFactory.cs プロジェクト: radtek/Omi
 public ColorfulDivCellFactory()
 {
     _colorSource = new ColorListDataSource();
     Styles       = new StyleDictionary();
 }
コード例 #24
0
        static DefaultStyleSheet()
        {
            styles = new StyleDictionary
                           {
                               new Style(ScopeName.PlainText)
                                   {
                                       Foreground = Colors.Black,
                                       Background = Colors.White
                                   },
                               new Style(ScopeName.HtmlServerSideScript)
                                   {
                                       Background = Colors.Yellow
                                   },
                               new Style(ScopeName.HtmlComment)
                                   {
                                       Foreground = Colors.Green
                                   },
                               new Style(ScopeName.HtmlTagDelimiter)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.HtmlElementName)
                                   {
                                       Foreground = DullRed
                                   },
                               new Style(ScopeName.HtmlAttributeName)
                                   {
                                       Foreground = Colors.Red
                                   },
                               new Style(ScopeName.HtmlAttributeValue)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.HtmlOperator)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.Comment)
                                   {
                                       Foreground = Colors.Green
                                   },
                               new Style(ScopeName.XmlDocTag)
                                   {
                                       Foreground = Colors.Gray
                                   },
                               new Style(ScopeName.XmlDocComment)
                                   {
                                       Foreground = Colors.Green
                                   },
                               new Style(ScopeName.String)
                                   {
                                       Foreground = DullRed
                                   },
                               new Style(ScopeName.StringCSharpVerbatim)
                                   {
                                       Foreground = DullRed
                                   },
                               new Style(ScopeName.Keyword)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.PreprocessorKeyword)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.HtmlEntity)
                                   {
                                       Foreground = Colors.Red
                                   },    
                               new Style(ScopeName.XmlAttribute)
                                   {
                                       Foreground = Colors.Red
                                   },
                               new Style(ScopeName.XmlAttributeQuotes)
                                   {
                                       Foreground = Colors.Black
                                   },
                               new Style(ScopeName.XmlAttributeValue)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.XmlCDataSection)
                                   {
                                       Foreground = Colors.Gray
                                   },
                               new Style(ScopeName.XmlComment)
                                   {
                                       Foreground = Colors.Green
                                   },
                               new Style(ScopeName.XmlDelimiter)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.XmlName)
                                   {
                                       Foreground = DullRed
                                   },
                               new Style(ScopeName.ClassName)
                                   {
                                       Foreground = Colors.Cyan, // .MediumTurquoise
                                   },
                               new Style(ScopeName.CssSelector)
                                   {
                                       Foreground = DullRed
                                   },
                               new Style(ScopeName.CssPropertyName)
                                   {
                                       Foreground = Colors.Red
                                   },
                               new Style(ScopeName.CssPropertyValue)
                                   {
                                       Foreground = Colors.Blue
                                   },
                               new Style(ScopeName.SqlSystemFunction)
                                   {
                                        Foreground = Colors.Magenta    
                                   },
                                new Style(ScopeName.JsonProperty)
                                   {
                                       Foreground = Color.FromArgb(255,0,96,128)
                                   },
                                new Style(ScopeName.JsonValue)
                                   {
                                       Foreground = Colors.Green
                                   },
                                new Style(ScopeName.BraceBracket)
                                   {
                                       Foreground = Colors.Brown
                                   },
                                new Style(ScopeName.SquareBracket)
                                   {
                                       Foreground = Colors.Brown
                                   },
                                new Style(ScopeName.Colon)
                                   {
                                       Foreground = Colors.Green
                                   },

                           };
        }
コード例 #25
0
 static DefaultStyleSheet()
 {
     styles = new StyleDictionary
     {
         new Style(ScopeName.PlainText)
         {
             Foreground   = Color.Black,
             Background   = Color.White,
             CssClassName = "plainText"
         },
         new Style(ScopeName.HtmlServerSideScript)
         {
             Background   = Color.Yellow,
             CssClassName = "htmlServerSideScript"
         },
         new Style(ScopeName.HtmlComment)
         {
             Foreground   = Color.Green,
             CssClassName = "htmlComment"
         },
         new Style(ScopeName.HtmlTagDelimiter)
         {
             Foreground   = Color.Blue,
             CssClassName = "htmlTagDelimiter"
         },
         new Style(ScopeName.HtmlElementName)
         {
             Foreground   = DullRed,
             CssClassName = "htmlElementName"
         },
         new Style(ScopeName.HtmlAttributeName)
         {
             Foreground   = Color.Red,
             CssClassName = "htmlAttributeName"
         },
         new Style(ScopeName.HtmlAttributeValue)
         {
             Foreground   = Color.Blue,
             CssClassName = "htmlAttributeValue"
         },
         new Style(ScopeName.HtmlOperator)
         {
             Foreground   = Color.Blue,
             CssClassName = "htmlOperator"
         },
         new Style(ScopeName.Comment)
         {
             Foreground   = Color.Green,
             CssClassName = "comment"
         },
         new Style(ScopeName.XmlDocTag)
         {
             Foreground   = Color.Gray,
             CssClassName = "xmlDocTag"
         },
         new Style(ScopeName.XmlDocComment)
         {
             Foreground   = Color.Green,
             CssClassName = "xmlDocComment"
         },
         new Style(ScopeName.String)
         {
             Foreground   = DullRed,
             CssClassName = "string"
         },
         new Style(ScopeName.StringCSharpVerbatim)
         {
             Foreground   = DullRed,
             CssClassName = "stringCSharpVerbatim"
         },
         new Style(ScopeName.Keyword)
         {
             Foreground   = Color.Blue,
             CssClassName = "keyword"
         },
         new Style(ScopeName.PreprocessorKeyword)
         {
             Foreground   = Color.Blue,
             CssClassName = "preprocessorKeyword"
         },
         new Style(ScopeName.HtmlEntity)
         {
             Foreground   = Color.Red,
             CssClassName = "htmlEntity"
         },
         new Style(ScopeName.XmlAttribute)
         {
             Foreground   = Color.Red,
             CssClassName = "xmlAttribute"
         },
         new Style(ScopeName.XmlAttributeQuotes)
         {
             Foreground   = Color.Black,
             CssClassName = "xmlAttributeQuotes"
         },
         new Style(ScopeName.XmlAttributeValue)
         {
             Foreground   = Color.Blue,
             CssClassName = "xmlAttributeValue"
         },
         new Style(ScopeName.XmlCDataSection)
         {
             Foreground   = Color.Gray,
             CssClassName = "xmlCDataSection"
         },
         new Style(ScopeName.XmlComment)
         {
             Foreground   = Color.Green,
             CssClassName = "xmlComment"
         },
         new Style(ScopeName.XmlDelimiter)
         {
             Foreground   = Color.Blue,
             CssClassName = "xmlDelimiter"
         },
         new Style(ScopeName.XmlName)
         {
             Foreground   = DullRed,
             CssClassName = "xmlName"
         },
         new Style(ScopeName.ClassName)
         {
             Foreground   = Color.MediumTurquoise,
             CssClassName = "className"
         },
         new Style(ScopeName.CssSelector)
         {
             Foreground   = DullRed,
             CssClassName = "cssSelector"
         },
         new Style(ScopeName.CssPropertyName)
         {
             Foreground   = Color.Red,
             CssClassName = "cssPropertyName"
         },
         new Style(ScopeName.CssPropertyValue)
         {
             Foreground   = Color.Blue,
             CssClassName = "cssPropertyValue"
         },
         new Style(ScopeName.SqlSystemFunction)
         {
             Foreground   = Color.Magenta,
             CssClassName = "sqlSystemFunction"
         },
         new Style(ScopeName.PowerShellAttribute)
         {
             Foreground   = Color.PowderBlue,
             CssClassName = "powershellAttribute"
         },
         new Style(ScopeName.PowerShellOperator)
         {
             Foreground   = Color.Gray,
             CssClassName = "powershellOperator"
         },
         new Style(ScopeName.PowerShellType)
         {
             Foreground   = Color.Teal,
             CssClassName = "powershellType"
         },
         new Style(ScopeName.PowerShellVariable)
         {
             Foreground   = Color.OrangeRed,
             CssClassName = "powershellVariable"
         }
     };
 }
コード例 #26
0
ファイル: ILCodeStyleSheet.cs プロジェクト: nnieslan/IL.View
    static ILCodeStyleSheet()
    {
      styles = new StyleDictionary
      {
          new Style(ScopeName.PlainText)
              {
                  Foreground = Colors.Black,
                  Background = Colors.White
              },
          //new Style(ScopeName.HtmlServerSideScript)
          //    {
          //        Background = Colors.Yellow
          //    },
          //new Style(ScopeName.HtmlComment)
          //    {
          //        Foreground = Colors.Green
          //    },
          //new Style(ScopeName.HtmlTagDelimiter)
          //    {
          //        Foreground = Colors.Blue
          //    },
          //new Style(ScopeName.HtmlElementName)
          //    {
          //        Foreground = DullRed
          //    },
          //new Style(ScopeName.HtmlAttributeName)
          //    {
          //        Foreground = Colors.Red
          //    },
          //new Style(ScopeName.HtmlAttributeValue)
          //    {
          //        Foreground = Colors.Blue
          //    },
          //new Style(ScopeName.HtmlOperator)
          //    {
          //        Foreground = Colors.Blue
          //    },
          new Style(ScopeName.Comment)
              {
                  Foreground = Colors.Green
              },
          //new Style(ScopeName.XmlDocTag)
          //    {
          //        Foreground = Colors.Gray
          //    },
          //new Style(ScopeName.XmlDocComment)
          //    {
          //        Foreground = Colors.Green
          //    },
          //new Style(ScopeName.String)
          //    {
          //        Foreground = DullRed
          //    },
          //new Style(ScopeName.StringCSharpVerbatim)
          //    {
          //        Foreground = DullRed
          //    },          
          //new Style(ScopeName.PreprocessorKeyword)
          //    {
          //        Foreground = Colors.Blue
          //    },
          //new Style(ScopeName.HtmlEntity)
          //    {
          //        Foreground = Colors.Red
          //    },    
          //new Style(ScopeName.XmlAttribute)
          //    {
          //        Foreground = Colors.Red
          //    },
          //new Style(ScopeName.XmlAttributeQuotes)
          //    {
          //        Foreground = Colors.Black
          //    },
          //new Style(ScopeName.XmlAttributeValue)
          //    {
          //        Foreground = Colors.Blue
          //    },
          //new Style(ScopeName.XmlCDataSection)
          //    {
          //        Foreground = Colors.Gray
          //    },
          //new Style(ScopeName.XmlComment)
          //    {
          //        Foreground = Colors.Green
          //    },
          //new Style(ScopeName.XmlDelimiter)
          //    {
          //        Foreground = Colors.Blue
          //    },
          //new Style(ScopeName.XmlName)
          //    {
          //        Foreground = DullRed
          //    },
          //new Style(ScopeName.ClassName)
          //    {
          //        Foreground = Colors.Cyan, // .MediumTurquoise
          //    },
          //new Style(ScopeName.CssSelector)
          //    {
          //        Foreground = DullRed
          //    },
          //new Style(ScopeName.CssPropertyName)
          //    {
          //        Foreground = Colors.Red
          //    },
          //new Style(ScopeName.CssPropertyValue)
          //    {
          //        Foreground = Colors.Blue
          //    },
          //new Style(ScopeName.SqlSystemFunction)
          //    {
          //        Foreground = Colors.Magenta    
          //    },


          new Style(ScopeName.Keyword)
              {
                  Foreground = Colors.Blue
              },
          new Style(ScopeName.Instruction)
              {
                  Foreground = Colors.Green
              },
          new Style(ScopeName.Directive)
              {
                  Foreground = Colors.Blue
              },
          new Style(ScopeName.Security)
              {
                  Foreground = Colors.Red
              },
          //new Style(ScopeName.LineNumber)
          //    {
          //        FontWeight = FontWeights.Bold,
          //        Foreground = Colors.Black                  
          //    },
      };
    }
コード例 #27
0
 static DefaultStyleSheet()
 {
     styles = new StyleDictionary
                  {
                      new Style(ScopeName.PlainText)
                          {
                              Foreground = Color.Black,
                              Background = Color.White
                          },
                      new Style(ScopeName.HtmlServerSideScript)
                          {
                              Background = Color.Yellow
                          },
                      new Style(ScopeName.HtmlComment)
                          {
                              Foreground = Color.Green
                          },
                      new Style(ScopeName.HtmlTagDelimiter)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.HtmlElementName)
                          {
                              Foreground = DullRed
                          },
                      new Style(ScopeName.HtmlAttributeName)
                          {
                              Foreground = Color.Red
                          },
                      new Style(ScopeName.HtmlAttributeValue)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.HtmlOperator)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.Comment)
                          {
                              Foreground = Color.Green
                          },
                      new Style(ScopeName.XmlDocTag)
                          {
                              Foreground = Color.Gray
                          },
                      new Style(ScopeName.XmlDocComment)
                          {
                              Foreground = Color.Green
                          },
                      new Style(ScopeName.String)
                          {
                              Foreground = DullRed
                          },
                      new Style(ScopeName.StringCSharpVerbatim)
                          {
                              Foreground = DullRed
                          },
                      new Style(ScopeName.Keyword)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.PreprocessorKeyword)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.HtmlEntity)
                          {
                              Foreground = Color.Red
                          },
                      new Style(ScopeName.XmlAttribute)
                          {
                              Foreground = Color.Red
                          },
                      new Style(ScopeName.XmlAttributeQuotes)
                          {
                              Foreground = Color.Black
                          },
                      new Style(ScopeName.XmlAttributeValue)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.XmlCDataSection)
                          {
                              Foreground = Color.Gray
                          },
                      new Style(ScopeName.XmlComment)
                          {
                              Foreground = Color.Green
                          },
                      new Style(ScopeName.XmlDelimiter)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.XmlName)
                          {
                              Foreground = DullRed
                          },
                      new Style(ScopeName.ClassName)
                          {
                              Foreground = Color.MediumTurquoise
                          },
                      new Style(ScopeName.CssSelector)
                          {
                              Foreground = DullRed
                          },
                      new Style(ScopeName.CssPropertyName)
                          {
                              Foreground = Color.Red
                          },
                      new Style(ScopeName.CssPropertyValue)
                          {
                              Foreground = Color.Blue
                          },
                      new Style(ScopeName.SqlSystemFunction)
                          {
                              Foreground = Color.Magenta
                          },
                      new Style(ScopeName.PowerShellAttribute)
                          {
                              Foreground = Color.PowderBlue
                          },
                      new Style(ScopeName.PowerShellOperator)
                          {
                              Foreground = Color.Gray
                          },
                      new Style(ScopeName.PowerShellType)
                          {
                              Foreground = Color.Teal
                          },
                      new Style(ScopeName.PowerShellVariable)
                          {
                              Foreground = Color.OrangeRed
                          }
                  };
 }
コード例 #28
0
 public TypeStyleSelector()
 {
     Styles = new StyleDictionary();
 }