Posted to tcl by apn at Wed Nov 29 15:21:26 GMT 2017view raw

  1. .SH
  2. NAME
  3. .PP
  4. \f[B]cmark\f[] \[en] Tcl interface to CommonMark / Github Flavored Markdown
  5. .SS
  6. SYNOPSIS
  7. .IP
  8. .nf
  9. \f[C]
  10. package require cmark
  11. cmark::render ?options? TEXT
  12. \f[]
  13. .fi
  14. .SS
  15. DESCRIPTION
  16. .PP
  17. The \f[C]cmark\f[] package provides a Tcl script level interface to the
  18. cmark\-gfm (https://github.com/github/cmark) library for parsing
  19. and rendering CommonMark (http://commonmark.org/) formatted text
  20. which is a formalized specification of the commonly used Markdown syntax.
  21. The library includes support for Github extensions which add several
  22. features to the original specification. The extended syntax
  23. accepted by the library is described in the
  24. Github Flavored Markdown (https://github.github.com/gfm/)
  25. specification. Here we refer to all these syntax variants collectively
  26. as CommonMark.
  27. .PP
  28. The primary command exported from the package is the \f[C]render\f[] command.
  29. .RS
  30. .RE
  31. .IP
  32. .nf
  33. \f[C]
  34. cmark::render ?options? TEXT
  35. \f[]
  36. .fi
  37. .PP
  38. The command parses \f[C]TEXT\f[] which should be in CommonMark format and
  39. returns it rendered in one of several different output formats. Currently
  40. supported output formats are HTML, Latex, Groff manpage, CommonMark
  41. XML, CommonMark and plain text.
  42. .SS
  43. Parsing
  44. .PP
  45. The following options affect parsing of \f[C]TEXT\f[].
  46. .PP
  47. \f[C]\-footnotes\f[]
  48. .RS
  49. .PP
  50. Enable parsing of footnotes.
  51. .RE
  52. .PP
  53. \f[C]\-ghprelang\f[]
  54. .RS
  55. .PP
  56. Uses Github style tags for code blocks that have a language
  57. attribute. This uses the \f[C]lang\f[] attribute on the \f[C]<pre>\f[] tag instead
  58. of a class on the \f[C]<code>\f[] tag that wrap the block.
  59. .RE
  60. .PP
  61. \f[C]\-liberaltag\f[]
  62. .RS
  63. .PP
  64. Be liberal in interpretation of HTML tags.
  65. .RE
  66. .PP
  67. \f[C]\-smart\f[]
  68. .RS
  69. .PP
  70. Replaces straight quotes with curly quotes and double or triple
  71. hyphens with en dash and em dash respectively.
  72. .RE
  73. .PP
  74. \f[C]\-utf8validate\f[]
  75. .RS
  76. .PP
  77. Checks and replaces invalid UTF\-8 character in \f[C]TEXT\f[] with the U+FFFD
  78. replacement character.
  79. .RE
  80. .SS
  81. Rendering
  82. .PP
  83. The following options control the rendering of the input text.
  84. .PP
  85. \f[C]\-hardbreaks\f[]
  86. .RS
  87. .PP
  88. Renders soft line breaks as hard line breaks.
  89. .RE
  90. .PP
  91. \f[C]\-nobreaks\f[]
  92. .RS
  93. .PP
  94. Renders soft line breaks as spaces.
  95. .RE
  96. .PP
  97. \f[C]\-safe\f[]
  98. .RS
  99. .PP
  100. Removes raw HTML by placeholder comments and unsafe links such as
  101. \f[C]javascript :\f[], \f[C]vbscript:\f[] etc. by empty strings.
  102. .RE
  103. .PP
  104. \f[C]\-sourcepos\f[]
  105. .RS
  106. .PP
  107. Includes the \f[C]data\-sourcepos\f[] attribute on all block elements.
  108. .RE
  109. .PP
  110. \f[C]\-to\f[] \f[C]FORMAT\f[]
  111. .RS
  112. .PP
  113. Specifies the output format. \f[C]FORMAT\f[] must be one of \f[C]html\f[], \f[C]latex\f[],
  114. \f[C]man\f[] , \f[C]xml\f[], \f[C]commonmark\f[] or \f[C]text\f[].
  115. .RE
  116. .PP
  117. \f[C]\-width\f[]
  118. .RS
  119. .PP
  120. Specifies a max line width for wrapping. The default of \f[C]0\f[] implies
  121. no wrapping. Only applies to CommonMark, Latex and man output
  122. formats.
  123. .RE
  124. .PP
  125. Note that the HTML output format is a fragment and does not include any HTML
  126. header boilerplate.
  127. .SS
  128. Enabling GFM extensions
  129. .PP
  130. By default, the command adheres to the CommonMark (http://commonmark.org/)
  131. specification. Various extensions specified in
  132. Github Flavored Markdown (https://github.github.com/gfm/) (GFM)
  133. may be enabled through the options below.
  134. .PP
  135. \f[C]\-gfm\f[]
  136. .RS
  137. .PP
  138. Enables all GFM extensions. Equivalent to specifying all options below.
  139. .RE
  140. .PP
  141. \f[C]\-autolink\f[]
  142. .RS
  143. .PP
  144. Enables autolink (https://github.github.com/gfm/#autolinks\-extension\-) enhancements.
  145. .RE
  146. .PP
  147. \f[C]\-strikethrough\f[]
  148. .RS
  149. .PP
  150. Enables the strikethrough (https://github.github.com/gfm/#strikethrough\-extension\-)
  151. extension for wrapping strikethrough text in tilde \f[C]~\f[] characters.
  152. .RE
  153. .PP
  154. \f[C]\-table\f[]
  155. .RS
  156. .PP
  157. Enables the table (https://github.github.com/gfm/#tables\-extension\-)
  158. for formatting tables.
  159. .RE
  160. .PP
  161. \f[C]\-tagfilter\f[]
  162. .RS
  163. .PP
  164. Enables the tagfilter (https://github.github.com/gfm/#disallowed\-raw\-html\-extension\-)
  165. extension that disallows certain HTML tags.
  166. .RE
  167. .SS
  168. AUTHOR
  169. .PP
  170. Ashok P. Nadkarni
  171.  
  172.