Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch markdown-syntax-highlight-gn Excluding Merge-Ins
This is equivalent to a diff from 738baecbc3 to 924478eb48
2018-02-02
| ||
03:48 | Merge to release RC: GN patches for doctools and markdown. check-in: a43c4df501 user: aku tags: tcllib-1-19-rc | |
03:38 | Merge to trunk: GN patches for doctools and markdown. check-in: 744a6b43a2 user: aku tags: trunk | |
02:33 | Pulling fixes from trunk check-in: f8e9464473 user: hypnotoad tags: hypnotoad | |
2018-02-01
| ||
18:31 | doctools2idx / doctools::idx::{export,import} <B,D> Fixed code typos (variable name), doc typos doctools2toc / doctools::toc::{export,import} s.a. Patch by Gustaf Neumann <[email protected]>, thank you. check-in: 27df9fe99f user: aku tags: doctools-typos-gn | |
04:47 | markdown / markdown <EF> - Applied patch adding syntax highlighting for `fenced code blocks` to the markdown package. Patch received from Gustaf Neumann <[email protected]>, with thanks. Closed-Leaf check-in: 924478eb48 user: aku tags: markdown-syntax-highlight-gn | |
2018-01-24
| ||
20:36 | Tkt [8fd2561785] oauth/oauth <B,D> Merged fix of query default to GET, was POST. check-in: 738baecbc3 user: aku tags: trunk | |
19:11 | Tkt [c247ed5db4] ldap/ldap <B,D>. Merge of fix for protocol error. check-in: 0826350f8d user: aku tags: trunk | |
2017-05-29
| ||
20:56 | Manually applied the patch from the ticket. Further some cleanup and simplification (Use 8.5 features (lassign, {*})) Closed-Leaf check-in: a0ec57b1bd user: aku tags: tkt-8fd2561785-ak | |
Changes to modules/markdown/markdown.man.
1 | [comment {-*- tcl -*- doctools manpage}] | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | [vset VERSION 1.1] [comment {-*- tcl -*- doctools manpage}] [manpage_begin markdown n [vset VERSION]] [moddesc {Markdown to HTML Converter}] [titledesc {Converts Markdown text to HTML}] [category {Text processing}] [require Tcl 8.5] [require Markdown [vset VERSION]] [require textutil [opt 0.8]] [description] The package [package Markdown] provides a command to convert Markdown annotated text into HMTL. [list_begin definitions] [call [cmd ::Markdown::convert] [arg "markdown"]] This command takes in a block of Markdown text, and returns a block of HTML. [para] The converter supports two types of syntax highlighting for fenced code blocks: highlighting via a registered converter (see [cmd ::Markdown::register]), or pure JavaScript highlighting, e.g. via "highlight.js", where the language specifier used in the markup is set as CSS class of the "code" element in the returned markup. [call [cmd ::Markdown::register] [arg "langspec"] [arg "converter"]] Register a language specific converter for prettifying a code block (e.g. syntax highlighting). Markdown supports fenced code blocks with an optional language specifier (e.g. "tcl"). When the markdown parser processes such a code block and a converter for the specified langspec is registered, the converter is called with the raw code block as argument. The converter is supposed to return the markup of the code block as result. The specified converter can be an arbitrary Tcl command, the raw text block is added as last argument upon invocation. [call [cmd ::Markdown::get_lang_counter]] Return a dict of language specifier and number of occurrences in fenced code blocks. This function can be used e.g. to detect, whether some CSS or JavaScript headers should be included for rendering without the need of postprocessing the rendered result. [call [cmd ::Markdown::reset_lang_counter]] Reset the language counters. [list_end] [vset CATEGORY textutil] [include ../doctools2base/include/feedback.inc] [manpage_end] |
Changes to modules/markdown/markdown.tcl.
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # COLLECT REFERENCES array unset ::Markdown::_references array set ::Markdown::_references [collect_references markdown] # PROCESS return [apply_templates markdown] } ## \private proc collect_references {markdown_var} { upvar $markdown_var markdown set lines [split $markdown \n] set no_lines [llength $lines] | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # COLLECT REFERENCES array unset ::Markdown::_references array set ::Markdown::_references [collect_references markdown] # PROCESS return [apply_templates markdown] } # # Register a language specific converter. This converter can be # used for fenced code blocks to transform the code block into a # prettified HTML. # proc register {lang_specifier converter} { set ::Markdown::converter($lang_specifier) $converter } # # Return a dict (attribute value pairs) of language specifiers and # the number of occurrences as they were used in fenced code blocks. # proc get_lang_counter {} { return [array get ::Markdown::lang_counter] } # # Reset the language counters of fenced code blocks. # proc reset_lang_counter {} { array unset ::Markdown::lang_counter } ## \private proc collect_references {markdown_var} { upvar $markdown_var markdown set lines [split $markdown \n] set no_lines [llength $lines] |
︙ | ︙ | |||
108 109 110 111 112 113 114 | set ul_match {^[ ]{0,3}(?:\*(?!\s*\*\s*\*\s*$)|-(?!\s*-\s*-\s*$)|\+) } set ol_match {^[ ]{0,3}\d+\. } # PROCESS MARKDOWN while {$index < $no_lines} { set line [lindex $lines $index] | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | set ul_match {^[ ]{0,3}(?:\*(?!\s*\*\s*\*\s*$)|-(?!\s*-\s*-\s*$)|\+) } set ol_match {^[ ]{0,3}\d+\. } # PROCESS MARKDOWN while {$index < $no_lines} { set line [lindex $lines $index] switch -regexp -matchvar matches -- $line { {^\s*$} { # EMPTY LINES if {![regexp {^\s*$} [lindex $lines [expr $index - 1]]]} { append result "\n\n" } incr index } |
︙ | ︙ | |||
227 228 229 230 231 232 233 | set line [lindex $lines $index] } set code_result [join $code_result \n] append result <pre><code> $code_result \n </code></pre> } | | < > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > | > > > > > | 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 | set line [lindex $lines $index] } set code_result [join $code_result \n] append result <pre><code> $code_result \n </code></pre> } {^(?:(?:`{3,})|(?:~{3,}))\{?(\S+)?\}?\s*$} { # FENCED CODE BLOCKS set code_result {} if {[string index $line 0] eq {`}} { set end_match {^`{3,}\s*$} } else { set end_match {^~{3,}\s*$} } # # A language specifier might be provided # immediately after the leading delimiters. # # ```tcl # # The language specifier is used for two purposes: # a) As a CSS class name # (useful e.g. for highlight.js) # b) As a name for a source code to HTML converter. # When such a converter is registered, # the codeblock will be sent through this converter. # set lang_specifier [string tolower [lindex $matches end]] if {$lang_specifier ne ""} { set code_CCS_class " class='$lang_specifier'" incr ::Markdown::lang_counter($lang_specifier) } else { set code_CCS_class "" } while {$index < $no_lines} { incr index set line [lindex $lines $index] if {[regexp $end_match $line]} { incr index break } lappend code_result $line } set code_result [join $code_result \n] # # If there is a converter registered, apply it on # the resulting snippet. # if {[info exists ::Markdown::converter($lang_specifier)]} { set code_result [{*}$::Markdown::converter($lang_specifier) $code_result] } else { set code_result [html_escape $code_result] } append result \ "<pre class='code'>" \ <code$code_CCS_class> \ $code_result \ </code></pre> } {^[ ]{0,3}(?:\*|-|\+) |^[ ]{0,3}\d+\. } { # LISTS set list_result {} # continue matching same list type if {[regexp $ol_match $line]} { set list_type ol |
︙ | ︙ | |||
747 748 749 750 751 752 753 | ## \private proc html_escape {text} { return [string map {& & < < > > \" "} $text] } } | | | 804 805 806 807 808 809 810 811 812 | ## \private proc html_escape {text} { return [string map {& & < < > > \" "} $text] } } package provide Markdown 1.1 |
Changes to modules/markdown/markdown.test.
︙ | ︙ | |||
408 409 410 411 412 413 414 415 416 417 418 419 | } -result { <ul> <li>asterisk 1 </li></ul> <hr/> } #------------------------------------------------------------------------- # Cleanup testsuiteCleanup | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | } -result { <ul> <li>asterisk 1 </li></ul> <hr/> } test mdtest-1.10 {fenced code block without language specifier} -body { convert { Here comes a generic example: ``` set x 1 ``` } } -result { <p>Here comes a generic example:</p> <pre class='code'><code>set x 1</code></pre> } test mdtest-1.11 {fenced code block with language specifier} -body { convert { Here comes a Tcl example: ```tcl set x 1 ``` } } -result { <p>Here comes a Tcl example:</p> <pre class='code'><code class='tcl'>set x 1</code></pre> } #------------------------------------------------------------------------- # Cleanup testsuiteCleanup |
Changes to modules/markdown/pkgIndex.tcl.
|
| < < < < < < < < < < | | 1 | package ifneeded Markdown 1.1 [list source [file join $dir markdown.tcl]] |