Markdown

Difference between version 37 and 38 - Previous - Next
'''[http://daringfireball.net/projects/markdown/%|%Markdown]''' is a
[lightweight markup languages%|%lightweight markup language].



** Description **

Originally created by John Gruber and Aaron Swartz, Markdown allows people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid [XHTML] or [HTML].  It is used to make the sources of static web pages more human readable,
and it is also more pleasant to write in than [HTML].  It has been used as a [wiki] formatting language, for example at [http://www.stackoverflow.com%|%StackOverflow].

----

'''[anoved] - 2012-12-20 19:22:24'''

A variant of Markdown is heavily used at GitHub, a [git] repository host, for formatting Readmes, issues, and other comments. https://help.github.com/articles/github-flavored-markdown/

[HJG] 2013-09-22 - Another variant of Markdown:  http://txt2tags.org/.
It uses python, and supports output to HTML, XHTML, SGML, DocBook, LaTeX, Lout, Man page, 
Creole, Wikipedia/MediaWiki, Google Code Wiki, PmWiki, DokuWiki, MoinMoin, MagicPoint, PageMaker, 
AsciiDoc, ASCII Art, Plain text.

[dbohdan] 2017-12-05: txt2tags is another lightweight markup language, but it is not a Markdown variant.


** Tools **

   [Caius] (unmaintained, superseded by its fork in Tcllib):   The CAIUS project has a pure Tcl package for processing Markdown.

   [CommonMark]:   A standardized version of Markdown. Also with Tcl bindings.

   [jimsoldout], [TclSoldout]:   Jim, Tcl bindings to libsoldout.

   [Markdown2Go]:   

   [tclhoedown]:   Tcl wrapper around Hoedown, a Markdown processor forked from Sundown (Sundown is no longer maintained).

   [Tcllib]:   Version 1.18 has a markdown module derived from tcl-markdown on github [https://github.com/wduquette/tcl-markdown].
   [Tclssg]:   Contains its own fork of the Caius mMarkdown package with bugfixes and an option to not convert tabs to spaces.

   [TclSundown] (unmaintained):   Tcl wrapper around Sundown, a Markdown processor ([AK], Nov 9, 2014: I have a copy of Jeremy's Fossil repository. If anybody is interested I can put it up somewhere).


** See Also **

   [MultiMarkdown]:   an extended version of Markdown


----

'''[JOB] - 2016-06-15 17:21:53'''

Utility script to convert all markup files in the current directory:

Prerequisites:

   * Perl must be installed on your machine,
   * markdown.pl again needs some more packages: html, json,...

======
package require Tk
catch {console show}

# convert to html using markdown

set dir [file dirname [info script]]

set mdcmd [file join $dir "util/Markdown.pl"]
set pattern "*.text"
set ext ".html"

# fix the directory name (required for glob under windows) ...
set basedir [string trimright [file join [file normalize $dir] { }]]

# execute markdown...

foreach f [glob -nocomplain -type {f r} -path $basedir $pattern] {

        # change file extension:
        set htmlfile [file rootname $f]
        append htmlfile $ext
        
        # puts "exec perl $mdcmd --html4tags $f > $htmlfile"
        eval exec perl $mdcmd --html4tags $f > $htmlfile &
}

# e.g. loading the browser...
set current_file [file join $dir "testfile.html"]
set command [list {*}[auto_execok start] {}]
exec {*}$command chrome $current_file &
puts "Done"
exit 0

======

The above script can be replaced by the following - a pure tcl markdown implementation available in tcllib as already described further up:


======
package require Tk
catch {console show}

# convert to html using markdown

set dir [file dirname [info script]]

lappend auto_path [file join $dir "lib"]

package require textutil
package require Markdown


set pattern "*.text"
set ext ".html"

# fix the directory name (required for glob under windows) ...
set basedir [string trimright [file join [file normalize $dir] { }]]

# execute markdown...

foreach f [glob -nocomplain -type {f r} -path $basedir $pattern] {

        # change file extension:
        set htmlfile [file rootname $f]
        append htmlfile $ext

        # slurp up the data file
        set fp [open $f "r"]
        set markup [read $fp]
        close $fp

        set fp [open $htmlfile "w"]
        puts -nonewline $fp [Markdown::convert $markup]
        close $fp
}

puts "Done"


if {1} {
        set current_file [file join $dir "testfile.html"]

        set command [list {*}[auto_execok start] {}]
        exec {*}$command chrome $current_file &
        exit 0
}
======


<<categories>> Word and Text Processing | HTML