-
Notifications
You must be signed in to change notification settings - Fork 37
/
markdown.php
329 lines (288 loc) · 9.03 KB
/
markdown.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?php defined('BASEPATH') || exit('No direct script access allowed');
/**
* Configuration settings for the CodeIgniter Markdown Library.
*
* https://github.com/jonlabelle/ci-markdown
*/
/*
| --------------------------------------------------------------------------
| Tab Width
| --------------------------------------------------------------------------
|
| This is the width of a tab character on input. Changing
| this will affect how many spaces a tab character represents.
|
| Note: Keep in mind that when the Markdown syntax spec says
| "four spaces or one tab", it actually means "four spaces
| after tabs are expanded to spaces". So setting tab_width
| to 8 will make parser treat a tab character as two levels
| of indentation.
|
| @int [ 4 ]
*/
$config['tab_width'] = 4;
/*
| --------------------------------------------------------------------------
| Allow Markup
| --------------------------------------------------------------------------
|
| Setting this variable to true will prevent HTML tags
| in the input from being passed to the output.
|
| Important: This is not a protection against malicious
| javascript being injected in a document. See why in
| Markdown and XSS https://michelf.ca/blog/2010/markdown-and-xss/
|
| @bool [ false ]
*/
$config['no_markup'] = false;
/*
| --------------------------------------------------------------------------
| Allow Entities
| --------------------------------------------------------------------------
|
| Setting this variable to true will prevent HTML entities
| (such as <) from being passed verbatim in the output
| as it is the standard with Markdown. Instead, the
| HTML output will be &tl; and once shown in shown
| the browser it will match perfectly what was written.
|
| @bool [ false ]
*/
$config['no_entities'] = false;
/*
| --------------------------------------------------------------------------
| Hard Wrap
| --------------------------------------------------------------------------
|
| Change to `true` to enable line breaks on "\n" without
| two trailing spaces.
|
| @bool [ false ]
*/
$config['hard_wrap'] = false;
/*
| --------------------------------------------------------------------------
| Predefined URLs
| --------------------------------------------------------------------------
|
| You can predefine reference links by setting predef_urls to a
| list of URLs where the key is the name of the reference.
|
| For instance:
|
| $parser->predef_urls = array('ref' => 'https://michelf.ca/');
|
| will make this Markdown input to create a link:
|
| This is [my website][ref].
|
| @array [ array() ]
*/
$config['predef_urls'] = array();
/*
| --------------------------------------------------------------------------
| Predefined Titles
| --------------------------------------------------------------------------
|
| Use predef_titles to set the title of the link references
| passed in predef_urls. As for predef_urls, the key is
| the reference name.
|
| @array [ array() ]
*/
$config['predef_titles'] = array();
/*
| --------------------------------------------------------------------------
| Predefined Abbreviations
| --------------------------------------------------------------------------
|
| You can predefine abbreviations by setting predef_abbr
| to a list of abbreviations where the key is the text of
| the abbreviation and the value is the expanded name.
|
| See: https://michelf.ca/projects/php-markdown/extra/#abbr
|
| @array [ array() ]
*/
$config['predef_abbr'] = array();
/*
| --------------------------------------------------------------------------
| Footnote ID Prefix
| --------------------------------------------------------------------------
|
| A prefix for the id attributes generated by footnotes.
| This is useful if you have multiple Markdown documents
| displayed inside one HTML document to avoid footnote
| ids to clash each other.
|
| @string [ '' ]
*/
$config['fn_id_prefix'] = '';
/*
| --------------------------------------------------------------------------
| Footnote Link Title
| --------------------------------------------------------------------------
|
| Optional title attribute for footnote links.
|
| @string [ '' ]
*/
$config['fn_link_title'] = '';
/*
| --------------------------------------------------------------------------
| Footnote Back-Link Title
| --------------------------------------------------------------------------
|
| Optional title attribute for footnote back-links.
|
| @string [ '' ]
*/
$config['fn_backlink_title'] = '';
/*
| --------------------------------------------------------------------------
| Footnote Link Class Attribute
| --------------------------------------------------------------------------
|
| Optional class attribute for footnote links.
|
| @string [ 'footnote-ref' ]
*/
$config['fn_link_class'] = 'footnote-ref';
/*
| --------------------------------------------------------------------------
| Footnote Back-Link Class Attribute
| --------------------------------------------------------------------------
|
| Optional class attribute for footnote back-links.
|
| @string [ 'footnote-backref' ]
*/
$config['fn_backlink_class'] = 'footnote-backref';
/*
| --------------------------------------------------------------------------
| Footnote Back-Link HTML
| --------------------------------------------------------------------------
|
| HTML content for a footnote back-link. The ︎ suffix
| in the default value is there to avoid the curled arrow
| being rendered as an emoji on mobile devices, but it might
| cause an unrecognized character to appear on older browsers.
|
| @string [ '↩︎' ]
*/
$config['fn_backlink_html'] = '↩︎';
/*
| --------------------------------------------------------------------------
| Table Align Class
| --------------------------------------------------------------------------
|
| Value for the class attribute determining the alignment
| of table cells. The default value, which is empty, will cause
| the align attribute to be used instead of class to specify
| the alignment.
|
| If not empty, the align attribute will not appear. Instead,
| the value for the class attribute will be determined by
| replacing any occurrence of %% within the string by left,
| center, or right. For instance, if the configuration
| variable is "go-%%" and the cell is right-aligned, the
| result will be: class="go-right".
|
| @string [ '' ]
*/
$config['table_align_class_tmpl'] = '';
/*
| --------------------------------------------------------------------------
| Code Class Prefix
| --------------------------------------------------------------------------
|
| An optional prefix for the class names associated with
| fenced code blocks. This will be prepended to the class
| name if you write your fenced code block this way:
|
| ~~~~ .html
| <br>
| ~~~~
|
| Note however that it has no effect if you add a class name
| using the more generic extra syntax that uses braces:
|
| ~~~~ {.html .flashy}
| <br>
| ~~~~
|
| @string [ '' ]
*/
$config['code_class_prefix'] = '';
/*
| --------------------------------------------------------------------------
| Code/Pre Attributes Option
| --------------------------------------------------------------------------
|
| When set to false (the default), attributes for code
| blocks will go on the <code> tag; setting this to
| true will put attributes on the <pre> tag instead.
|
| @bool [ false ]
*/
$config['code_attr_on_pre'] = false;
/*
| --------------------------------------------------------------------------
| Enhanced ordered List
| --------------------------------------------------------------------------
|
| Class attribute to toggle "enhanced ordered list"
| behavior setting this to true will allow ordered lists
| to start from the index number that is defined first.
|
| For example:
|
| 2. List item two
| 3. List item three
|
| becomes...
|
| <ol start="2">
| <li>List item two</li>
| <li>List item three</li>
| </ol>
|
| @bool [ true ]
*/
$config['enhanced_ordered_list'] = true;
/*
| --------------------------------------------------------------------------
| Empty Element/Tag Suffix
| --------------------------------------------------------------------------
|
| This is the string used to close tags for HTML elements
| with no content such as <br> and <hr>.
|
| @string [ '>' ]
*/
$config['empty_element_suffix'] = '>';
/*
| --------------------------------------------------------------------------
| Hash Tag Protection
| --------------------------------------------------------------------------
|
| When true, prevents ATX-style headers with no space after
| the initial hash from being interpreted as headers. This way
| those precious hash tags can be preserved.
|
| @bool [ false ]
*/
$config['hashtag_protection'] = false;
/*
| --------------------------------------------------------------------------
| Omit Footnotes
| --------------------------------------------------------------------------
|
| Determines whether footnotes should be appended to the end
| of the document. If true, footnote html can be retrieved from
| $this->footnotes_assembled.
|
| @bool [ false ]
*/
$config['omit_footnotes'] = false;