1markdown(n) Markdown to HTML Converter markdown(n)
2
3
4
5______________________________________________________________________________
6
8 markdown - Converts Markdown text to HTML
9
11 package require Tcl 8.5
12
13 package require Markdown 1.2.2
14
15 package require textutil ?0.8?
16
17 ::Markdown::convert markdown
18
19 ::Markdown::register langspec converter
20
21 ::Markdown::get_lang_counter
22
23 ::Markdown::reset_lang_counter
24
25______________________________________________________________________________
26
28 The package Markdown provides a command to convert Markdown annotated
29 text into HMTL.
30
31 ::Markdown::convert markdown
32 This command takes in a block of Markdown text, and returns a
33 block of HTML.
34
35 The converter supports two types of syntax highlighting for
36 fenced code blocks: highlighting via a registered converter (see
37 ::Markdown::register), or pure JavaScript highlighting, e.g. via
38 "highlight.js", where the language specifier used in the markup
39 is set as CSS class of the "code" element in the returned
40 markup.
41
42 ::Markdown::register langspec converter
43 Register a language specific converter for prettifying a code
44 block (e.g. syntax highlighting). Markdown supports fenced code
45 blocks with an optional language specifier (e.g. "tcl"). When
46 the markdown parser processes such a code block and a converter
47 for the specified langspec is registered, the converter is
48 called with the raw code block as argument. The converter is
49 supposed to return the markup of the code block as result. The
50 specified converter can be an arbitrary Tcl command, the raw
51 text block is added as last argument upon invocation.
52
53 ::Markdown::get_lang_counter
54 Return a dict of language specifier and number of occurrences in
55 fenced code blocks. This function can be used e.g. to detect,
56 whether some CSS or JavaScript headers should be included for
57 rendering without the need of postprocessing the rendered re‐
58 sult.
59
60 ::Markdown::reset_lang_counter
61 Reset the language counters.
62
64 This markdown converter supports the original markdown by Gruber and
65 Swartz (see their syntax [https://daringfireball.net/projects/mark‐
66 down/syntax] page for details):
67
68 • paragraphs
69
70 • atx- and setext-style headers
71
72 • blockquotes
73
74 • emphasis and strong emphasis
75
76 • unordered and ordered lists
77
78 • inline-style, reference-style and automatic links
79
80 • inline- and reference-style images
81
82 • inline code
83
84 • code blocks (with four indent spaces or one tab)
85
86 • inline HTML
87
88 • backslash escapes
89
90 • horizontal rules
91
92 In addition, the following extended markdown sytax is supported, taken
93 from PHP Markdown Extra and GFM (Github Flavoured Markdown):
94
95 • pipe tables
96
97 • fenced code blocks (with an optional language specifier)
98
100 This document, and the package it describes, will undoubtedly contain
101 bugs and other problems. Please report such in the category textutil
102 of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
103 also report any ideas for enhancements you may have for either package
104 and/or documentation.
105
106 When proposing code changes, please provide unified diffs, i.e the out‐
107 put of diff -u.
108
109 Note further that attachments are strongly preferred over inlined
110 patches. Attachments can be made by going to the Edit form of the
111 ticket immediately after its creation, and then using the left-most
112 button in the secondary navigation bar.
113
115 Text processing
116
117
118
119tcllib 1.2.2 markdown(n)