QScintilla/MarkupProviders/MarkdownProvider.py

changeset 5402
ce21a78a5fcf
parent 5398
1f4509cf8f35
child 5404
6b19ad5470a3
equal deleted inserted replaced
5401:dbbbd94aec0b 5402:ce21a78a5fcf
38 @return flag indicating the availability of bold markup 38 @return flag indicating the availability of bold markup
39 @rtype bool 39 @rtype bool
40 """ 40 """
41 return True 41 return True
42 42
43 def bold(self, editor):
44 """
45 Public method to generate bold text.
46
47 @param editor reference to the editor to work on
48 @type Editor
49 """
50 self.__insertMarkup("**", editor)
51
43 def hasItalic(self): 52 def hasItalic(self):
44 """ 53 """
45 Public method to indicate the availability of italic markup. 54 Public method to indicate the availability of italic markup.
46 55
47 @return flag indicating the availability of italic markup 56 @return flag indicating the availability of italic markup
48 @rtype bool 57 @rtype bool
49 """ 58 """
50 return True 59 return True
60
61 def italic(self, editor):
62 """
63 Public method to generate italic text.
64
65 @param editor reference to the editor to work on
66 @type Editor
67 """
68 self.__insertMarkup("_", editor)
51 69
52 def hasStrikethrough(self): 70 def hasStrikethrough(self):
53 """ 71 """
54 Public method to indicate the availability of strikethrough markup. 72 Public method to indicate the availability of strikethrough markup.
55 73
56 @return flag indicating the availability of strikethrough markup 74 @return flag indicating the availability of strikethrough markup
57 @rtype bool 75 @rtype bool
58 """ 76 """
59 return True 77 return True
60 78
79 def strikethrough(self, editor):
80 """
81 Public method to generate strikethrough text.
82
83 @param editor reference to the editor to work on
84 @type Editor
85 """
86 self.__insertMarkup("~~", editor)
87
61 def headerLevels(self): 88 def headerLevels(self):
62 """ 89 """
63 Public method to determine the available header levels. 90 Public method to determine the available header levels.
64 91
65 @return supported header levels 92 @return supported header levels
66 @rtype int 93 @rtype int
67 """ 94 """
68 return 6 95 return 6
69
70 def bold(self, editor):
71 """
72 Public method to generate bold text.
73
74 @param editor reference to the editor to work on
75 @type Editor
76 """
77 self.__insertMarkup("**", editor)
78
79 def italic(self, editor):
80 """
81 Public method to generate italic text.
82
83 @param editor reference to the editor to work on
84 @type Editor
85 """
86 self.__insertMarkup("_", editor)
87
88 def strikethrough(self, editor):
89 """
90 Public method to generate strikethrough text.
91
92 @param editor reference to the editor to work on
93 @type Editor
94 """
95 self.__insertMarkup("~~", editor)
96 96
97 def header(self, editor, level): 97 def header(self, editor, level):
98 """ 98 """
99 Public method to generate a header. 99 Public method to generate a header.
100 100
109 editor.beginUndoAction() 109 editor.beginUndoAction()
110 cline, cindex = editor.getCursorPosition() 110 cline, cindex = editor.getCursorPosition()
111 editor.insertAt(level * "#" + " ", cline, 0) 111 editor.insertAt(level * "#" + " ", cline, 0)
112 editor.setCursorPosition(cline, level + 1) 112 editor.setCursorPosition(cline, level + 1)
113 editor.endUndoAction() 113 editor.endUndoAction()
114
115 def hasCode(self):
116 """
117 Public method to indicate the availability of inline code markup.
118
119 @return flag indicating the availability of inline code markup
120 @rtype bool
121 """
122 return True
123
124 def code(self, editor):
125 """
126 Public method to generate inline code text.
127
128 @param editor reference to the editor to work on
129 @type Editor
130 """
131 self.__insertMarkup("`", editor)
114 132
115 def __insertMarkup(self, markup, editor): 133 def __insertMarkup(self, markup, editor):
116 """ 134 """
117 Private method to insert the specified markup. 135 Private method to insert the specified markup.
118 136

eric ide

mercurial