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.1
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
58 result.
59
60 ::Markdown::reset_lang_counter
61 Reset the language counters.
62
64 This document, and the package it describes, will undoubtedly contain
65 bugs and other problems. Please report such in the category textutil
66 of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
67 also report any ideas for enhancements you may have for either package
68 and/or documentation.
69
70 When proposing code changes, please provide unified diffs, i.e the out‐
71 put of diff -u.
72
73 Note further that attachments are strongly preferred over inlined
74 patches. Attachments can be made by going to the Edit form of the
75 ticket immediately after its creation, and then using the left-most
76 button in the secondary navigation bar.
77
79 Text processing
80
81
82
83tcllib 1.1 markdown(n)