'''[http://daringfireball.net/projects/markdown/%|%Markdown]''' is a [lightweight markup languages%|%lightweight markup language]. ** Description ** Originally created by John Gruber and Aaron Swartz in 2004, 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 is used as a markup language, for example at: * [http://www.stackoverflow.com%|%StackOverflow] * GitHub, a [git] repository host, for formatting Readme files, issues, and other comments (https://help.github.com/articles/github-flavored-markdown/) * GitLab, another git repository hosting service * [fossil], a distributed SCM * DEVONthink, a knowledge database software for documents * OneDay, a diary software * Things, a todo software * Jupyter Notebook, an application for writing documents combining live-code with text etc. * [ruff], [mkdoc::mkdoc], [tmdoc::tmdoc], Tcl packages for source code documentation (and literate programming) * [mkdic] * RMarkdown, mixing markdown and [R] code in a kind of [literate programming] ** Variants ** The original markdown specification from 2004 is only loosely defined. The [commonmark] specification is a strict definition of how to format a document using markdown. Besides this, many variants of markdown have evolved, each typically adding some features not included in the original. For example: * GFM = Github-flavoured markdown * [MultiMarkdown] * [pandoc]'s markdown * Markdown Extra (PHP markdown) * Kramdown * Extramark * [CommonMark] * Maruku * Markdeep ** Markup languages similar to Markdown ** [HJG] 2013-09-22 - 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. Other similar ones are for example: AsciiDoc, Creole, reStructuedText, DocBook or Textile ** 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. [cmark]: Tcl wrapper for CommonMark. [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 Markdown 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). ---- '''[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 } ====== <> Word and Text Processing | HTML