Text::Markdown::Discount
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
4.4 KiB

  1. .\"
  2. .Dd Dec 22, 2007
  3. .Dt MKD-EXTENSIONS 7
  4. .Os MASTODON
  5. .Sh NAME
  6. .Nm mkd-extensions
  7. .Nd Extensions to the Markdown text formatting syntax
  8. .Sh DESCRIPTION
  9. This version of markdown has been extended in a few ways by
  10. extending existing markup, creating new markup from scratch,
  11. and borrowing markup from other markup languages.
  12. .Ss Image dimensions
  13. Markdown embedded images have been extended to allow specifying
  14. the dimensions of the image by adding a new argument
  15. .Em =/height/x/width/
  16. to the link description.
  17. .Pp
  18. The new image syntax is
  19. .nf
  20. ![alt text](image =/height/x/width/ "title")
  21. .fi
  22. .Ss pseudo-protocols
  23. Five pseudo-protocols have been added to links
  24. .Bl -tag -width XXXXX
  25. .It Ar id:
  26. The
  27. .Ar "alt text"
  28. is marked up and written to the output, wrapped with
  29. .Em "<a id=id>"
  30. and
  31. .Em "</a>" .
  32. .It Ar class:
  33. The
  34. .Ar "alt text"
  35. is marked up and written to the output, wrapped with
  36. .Em "<span class=class>"
  37. and
  38. .Em "</span>" .
  39. .It Ar raw:
  40. The
  41. .Ar title
  42. is written
  43. .Em -- with no further processing --
  44. to the output. The
  45. .Ar "alt text"
  46. is discarded.
  47. .It Ar abbr:
  48. The
  49. .Ar "alt text"
  50. is marked up and written to the output, wrapped with
  51. .Em "<abbr title=abbr>"
  52. and
  53. .Em "</abbr>" .
  54. .It Ar lang:
  55. The
  56. .Ar "alt text"
  57. s marked up and written to the output, wrapped with
  58. .Em "<span lang=lang>"
  59. and
  60. .Em "</span>" .
  61. .El
  62. .Ss Pandoc headers
  63. The markdown source document can have a 3-line
  64. .Xr Pandoc
  65. header in the format of
  66. .nf
  67. % title
  68. % author(s)
  69. % date
  70. .fi
  71. which will be made available to the
  72. .Fn mkd_doc_title ,
  73. .Fn mkd_doc_author ,
  74. and
  75. .Fn mkd_doc_date
  76. functions.
  77. .Ss Definition lists
  78. A definition list item
  79. is defined as
  80. .nf
  81. =tag=
  82. description
  83. .fi
  84. (that is a
  85. .Ar = ,
  86. followed by text, another
  87. .Ar = ,
  88. a newline, 4 spaces of intent, and then more text.)
  89. .Pp
  90. Alternatively, definition list items are defined as
  91. .nf
  92. tag
  93. : description
  94. .fi
  95. (This is the format that
  96. .Ar "PHP Markdown Extra"
  97. uses.)
  98. .Pp
  99. .Ss embedded stylesheets
  100. Stylesheets may be defined and modified in a
  101. .Em <style>
  102. block. A style block is parsed like any other
  103. block level html;
  104. .Em <style>
  105. starting on column 1, raw html (or, in this case, css) following
  106. it, and either ending with a
  107. .Em </style>
  108. at the end of the line or a
  109. .Em </style>
  110. at the beginning of a subsequent line.
  111. .Pp
  112. Be warned that style blocks work like footnote links -- no matter
  113. where you define them they are valid for the entire document.
  114. .Ss relaxed emphasis
  115. The rules for emphasis are changed so that a single
  116. .Ar _
  117. will
  118. .Em not
  119. count as a emphasis character if it's in the middle of a word.
  120. This is primarily for documenting code, if you don't wish to
  121. have to backquote all code references.
  122. .Ss alpha lists
  123. Alphabetic lists (like regular numeric lists, but with alphabetic
  124. items) are supported. So:
  125. .nf
  126. a. this
  127. b. is
  128. c. an alphabetic
  129. d. list
  130. .fi
  131. will produce:
  132. .nf
  133. <ol type=a>
  134. <li>this</li>
  135. <li>is</li>
  136. <li>an alphabetic</li>
  137. <li>list</li>
  138. </ol>
  139. .fi
  140. .Ss tables
  141. .Ar "PHP Markdown Extra"
  142. tables are supported; input of the form
  143. .nf
  144. header|header
  145. ------|------
  146. text | text
  147. .fi
  148. will produce:
  149. .nf
  150. <table>
  151. <thead>
  152. <tr>
  153. <th>header</th>
  154. <th>header</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. <tr>
  159. <td>text</td>
  160. <td>text</td>
  161. </tr>
  162. </tbody>
  163. </table>
  164. .fi
  165. The dashed line can also contain
  166. .Em :
  167. characters for formatting; if a
  168. .Em :
  169. is at the start of a column, it tells
  170. .Nm discount
  171. to align the cell contents to the left; if it's at the end, it
  172. aligns right, and if there's one at the start and at the
  173. end, it centers.
  174. .Ss strikethrough
  175. A strikethrough syntax is supported in much the same way that
  176. .Ar `
  177. is used to define a section of code. If you enclose text with
  178. two or more tildes, such as
  179. .Em ~~erased text~~
  180. it will be written as
  181. .Em "<del>erased text</del>" .
  182. Like code sections, you may use as many
  183. .Ar ~
  184. as you want, but there must be as many starting tildes as closing
  185. tildes.
  186. .Ss markdown extra-style footnotes
  187. .Ar "PHP Markdown Extra"
  188. footnotes are supported. If a footnote link begins with a
  189. .Ar ^ ,
  190. the first use of that footnote will generate a link down to the
  191. bottom of the rendered document, which will contain a numbered footnote
  192. with a link back to where the footnote was called.
  193. .Sh AUTHOR
  194. David Parsons
  195. .%T http://www.pell.portland.or.us/~orc/
  196. .Sh SEE ALSO
  197. .Xr markdown 1 ,
  198. .Xr markdown 3 ,
  199. .Xr mkd-callbacks 3 ,
  200. .Xr mkd-functions 3 ,
  201. .Xr mkd-line 3 .
  202. .Pp
  203. .%T http://daringfireball.net/projects/markdown
  204. .Pp
  205. .%T http://michelf.com/projects/php-markdown