qscilexermarkdown.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // This defines the interface to the QsciLexerMarkdown class.
  2. //
  3. // Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
  4. //
  5. // This file is part of QScintilla.
  6. //
  7. // This file may be used under the terms of the GNU General Public License
  8. // version 3.0 as published by the Free Software Foundation and appearing in
  9. // the file LICENSE included in the packaging of this file. Please review the
  10. // following information to ensure the GNU General Public License version 3.0
  11. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  12. //
  13. // If you do not wish to use this file under the terms of the GPL version 3.0
  14. // then you may purchase a commercial license. For more information contact
  15. // info@riverbankcomputing.com.
  16. //
  17. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  18. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19. #ifndef QSCILEXERMARKDOWN_H
  20. #define QSCILEXERMARKDOWN_H
  21. #include <QObject>
  22. #include <Qsci/qsciglobal.h>
  23. #include <Qsci/qscilexer.h>
  24. //! \brief The QsciLexerMarkdown class encapsulates the Scintilla Markdown
  25. //! lexer.
  26. class QSCINTILLA_EXPORT QsciLexerMarkdown : public QsciLexer
  27. {
  28. Q_OBJECT
  29. public:
  30. //! This enum defines the meanings of the different styles used by the
  31. //! Markdown lexer.
  32. // Note that some values are omitted (ie. LINE_BEGIN and PRECHAR) as these
  33. // seem to be internal state information rather than indicating that text
  34. // should be styled differently.
  35. enum {
  36. //! The default.
  37. Default = 0,
  38. //! Special (e.g. end-of-line codes if enabled).
  39. Special = 1,
  40. //! Strong emphasis using double asterisks.
  41. StrongEmphasisAsterisks = 2,
  42. //! Strong emphasis using double underscores.
  43. StrongEmphasisUnderscores = 3,
  44. //! Emphasis using single asterisks.
  45. EmphasisAsterisks = 4,
  46. //! Emphasis using single underscores.
  47. EmphasisUnderscores = 5,
  48. //! A level 1 header.
  49. Header1 = 6,
  50. //! A level 2 header.
  51. Header2 = 7,
  52. //! A level 3 header.
  53. Header3 = 8,
  54. //! A level 4 header.
  55. Header4 = 9,
  56. //! A level 5 header.
  57. Header5 = 10,
  58. //! A level 6 header.
  59. Header6 = 11,
  60. //! Pre-char (up to three indent spaces, e.g. for a sub-list).
  61. Prechar = 12,
  62. //! An unordered list item.
  63. UnorderedListItem = 13,
  64. //! An ordered list item.
  65. OrderedListItem = 14,
  66. //! A block quote.
  67. BlockQuote = 15,
  68. //! Strike out.
  69. StrikeOut = 16,
  70. //! A horizontal rule.
  71. HorizontalRule = 17,
  72. //! A link.
  73. Link = 18,
  74. //! Code between backticks.
  75. CodeBackticks = 19,
  76. //! Code between double backticks.
  77. CodeDoubleBackticks = 20,
  78. //! A code block.
  79. CodeBlock = 21,
  80. };
  81. //! Construct a QsciLexerMarkdown with parent \a parent. \a parent is
  82. //! typically the QsciScintilla instance.
  83. QsciLexerMarkdown(QObject *parent = 0);
  84. //! Destroys the QsciLexerMarkdown instance.
  85. virtual ~QsciLexerMarkdown();
  86. //! Returns the name of the language.
  87. const char *language() const;
  88. //! Returns the name of the lexer. Some lexers support a number of
  89. //! languages.
  90. const char *lexer() const;
  91. //! Returns the foreground colour of the text for style number \a style.
  92. //!
  93. //! \sa defaultPaper()
  94. QColor defaultColor(int style) const;
  95. //! Returns the font for style number \a style.
  96. QFont defaultFont(int style) const;
  97. //! Returns the background colour of the text for style number \a style.
  98. //!
  99. //! \sa defaultColor()
  100. QColor defaultPaper(int style) const;
  101. //! Returns the descriptive name for style number \a style. If the
  102. //! style is invalid for this language then an empty QString is returned.
  103. //! This is intended to be used in user preference dialogs.
  104. QString description(int style) const;
  105. private:
  106. QsciLexerMarkdown(const QsciLexerMarkdown &);
  107. QsciLexerMarkdown &operator=(const QsciLexerMarkdown &);
  108. };
  109. #endif