Edgewall Software

Changes between Version 1 and Version 2 of MarkDown


Ignore:
Timestamp:
Mar 6, 2013, 1:24:31 AM (11 years ago)
Author:
Christian Boos
Comment:

some work notes on possible Markdown extensions to the WikiFormatting syntax

Legend:

Unmodified
Added
Removed
Modified
  • MarkDown

    v1 v2  
    11= Markdown
     2
     3[[PageOutline(2-3)]]
    24
    35[http://daringfireball.net/projects/markdown/basics/ Markdown] is a semi-structured markup language originally designed for blogs which is now used in several wikis as well.
     
    68See [http://github.github.com/github-flavored-markdown/ Introduction to GFM] and  [http://stackoverflow.com/editing-help/ Markdown help] respectively for what variant is supported in each.
    79
    8 
    9 A lot of this is close to WikiCreole, ReST and our own markup. See also TracDev/Proposals/AdvancedWikiFormatting for some things that could be stolen from it.
     10A lot of this is close to WikiCreole, ReST and our own markup. Most of the time, the markdown syntax makes a lot of sense and would fit well with our current syntax (in particular the rules for nesting paragraphs). And the rest is damn interesting as well!
     11
     12The new WikiEngine should make it possible to implement optional or conditional support for Markdown, for the features that conflict with the current syntax.
     13
     14So let's go through the details of the basic syntax, of the advanced syntax and of its popular extensions.
     15
     16
     17== [http://daringfireball.net/projects/markdown/basics Basic features]
     18
     19=== PARAGRAPHS, HEADERS, BLOCKQUOTES
     20{{{
     21A First Level Header
     22====================
     23
     24A Second Level Header
     25---------------------
     26
     27Now is the time for all good men to come to
     28the aid of their country. This is just a
     29regular paragraph.
     30
     31The quick brown fox jumped over the lazy
     32dog's back.
     33
     34### Header 3
     35
     36> This is a blockquote.
     37>
     38> This is the second paragraph in the blockquote.
     39>
     40> ## This is an H2 in a blockquote
     41}}}
     42
     43The first level and second level headers are really a thing to have, as it's also supported in reStructuredText.
     44
     45The `###` for sections is problematic, as this conflicts with WikiCreole's numbered lists.
     46
     47=== PHRASE EMPHASIS
     48
     49{{{
     50Some of these words *are emphasized*.
     51Some of these words _are emphasized also_.
     52
     53Use two asterisks for **strong emphasis**.
     54Or, if you prefer, __use two underscores instead__.
     55}}}
     56
     57These ones must be handled with care.
     58
     59=== LISTS
     60
     61Unnumbered lists, same as us with `*` and `-` but also `+`.
     62Numbered lists, same as us.
     63
     64**But**:
     65{{{
     66*   A list item.
     67
     68    With multiple paragraphs.
     69
     70*   Another item in the list.
     71}}}
     72
     73This is a huge win and one of the main motivator behind the new engine... (see #8140, #1936)
     74
     75=== LINKS
     76
     77This:
     78{{{
     79This is an [example link](http://example.com/).
     80}}}
     81and that:
     82{{{
     83This is an [example link](http://example.com/ "With a Title").
     84}}}
     85
     86
     87References:
     88{{{
     89I get 10 times more traffic from [Google][1] than from
     90[Yahoo][2] or [MSN][3].
     91
     92[1]: http://google.com/        "Google"
     93[2]: http://search.yahoo.com/  "Yahoo Search"
     94[3]: http://search.msn.com/    "MSN Search"
     95
     96I start my morning with a cup of coffee and
     97[The New York Times][NY Times].
     98
     99[ny times]: http://www.nytimes.com/
     100}}}
     101... challenging.
     102
     103=== IMAGES
     104
     105{{{
     106![alt text](/path/to/img.jpg "Title")
     107
     108![alt text][id]
     109
     110[id]: /path/to/img.jpg "Title"
     111}}}
     112So we'll have to find another way than the usual `!...` for escaping links. In Markdown, it's usually `\` which is used for escaping markup.
     113
     114At first it looks like a very simple alternative to the Image macro, however I've seen things like:
     115{{{
     116[![Build Status](https://secure.travis-ci.org/libgit2/libgit2.png?branch=development)](http://travis-ci.org/libgit2/libgit2)
     117}}}
     118i.e. the image link can be written inside the label part of a normal link (like other inline markup).
     119
     120... challenging again! But we also wanted that already for our own TracLinks, see #9123.
     121
     122Note that some tricky stuff like {{{[`o]o`](http://example.com)}}} easily confuses the GitHub parser...
     123
     124
     125=== CODE
     126
     127We have {{{`...`}}} also.
     128
     129But see below...
     130
     131== [http://daringfireball.net/projects/markdown/syntax Advanced features]
     132
     133=== INLINE HTML
     134
     135{{{
     136This is a regular paragraph.
     137
     138<table>
     139    <tr>
     140        <td>Foo</td>
     141    </tr>
     142</table>
     143
     144This is another regular paragraph.
     145}}}
     146The original spec mention that the content of these elements is not parsed as Markdown, but some [http://michelf.ca/projects/php-markdown/extra/#markdown-attr extensions] allow for it.
     147
     148So this *might* be an alternative to our WikiProcessors for WikiHtml.
     149
     150=== BLOCKQUOTES
     151"Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:"
     152{{{
     153> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
     154consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
     155Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
     156
     157> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
     158id sem consectetuer libero luctus adipiscing.
     159}}}
     160
     161=== LISTS
     162
     163"It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:"
     164{{{
     165*   This is a list item with two paragraphs.
     166
     167    This is the second paragraph in the list item. You're
     168only required to indent the first line. Lorem ipsum dolor
     169sit amet, consectetuer adipiscing elit.
     170
     171*   Another item in the same list.
     172}}}
     173
     174Damn, this breaks the base assumption of the [TracDev/Proposals/VerticalHorizontalParsing vertical/horizontal parsing].
     175
     176
     177=== CODE
     178
     179{{{
     180``There is a literal backtick (`) here.``
     181}}}
     182
     183
     184== [https://help.github.com/articles/github-flavored-markdown GitHub Flavored Markdown]
     185
     186=== Newlines
     187
     188This is our "standard" //respect new line// setting. Applied in tickets, not in wiki pages.
     189
     190=== Multiple underscores in words
     191
     192Sure, perform_complicated_task shouldn't become perform//complicated//task.
     193
     194We could even auto-verbatim these...
     195
     196=== URL autolinking
     197
     198We have.
     199
     200=== Fenced code blocks
     201
     202{{{
     203```
     204verbatim
     205         text
     206              here
     207
     208```
     209}}}
     210With optional syntax-highlighting: {{{```ruby}}}.
     211
     212Well, in fact our usual `#!processor args` should apply here ({{{```processor args}}}).
     213
     214See #10734.
     215
     216=== [https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments Task Lists]
     217
     218Aha! Thought about them since a long time, and finally GitHub did it...
     219
     220It's only possible to support if we're able to rewrite the original wiki text from the parsed data.
     221
     222=== Quick quoting
     223
     224Well, that's more an UI thing, but why not.
     225
     226=== Name and Team @mentions autocomplete
     227
     228Once we have a better notion of users ...
     229
     230But `@user` syntax seems to have become the de-facto standard (I would have preferred ~user though).
     231
     232Auto-complete could be used for a great deal of other things (WikiPageNames and WikiMacros, source paths, attachment names, etc. See #9296).
     233
     234=== Emoji autocomplete
     235
     236Some kind of integration with the WikiExtras `(|...|)` -> `:...:`.
     237
     238=== Issue autocompletion
     239
     240Intelligent auto-completion, perhaps even with filtering. Well, this is also an UI topic, nothing special about the syntax.
     241
     242=== Zen Mode (fullscreen) writing
     243
     244Also UI.
     245
     246=== Closing issues via commit messages
     247
     248We have.
     249
     250=== References
     251{{{
     252* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
     253* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
     254* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
     255* \#Num: #1
     256* User/#Num: mojombo#1
     257* User/Project#Num: mojombo/god#1
     258}}}
     259References to SHA1 numbers are/should be unique enough for not having to ask the user to add the repository name. However, if it's added then we know explicitly where to go (in case the same commit is present in multiple repositories).
     260
     261== [http://michelf.ca/projects/php-markdown/extra/ Markdown Extra]
     262
     263== [http://fletcherpenney.net/multimarkdown/ MultiMarkdown]
     264
     265 * footnotes
     266 * tables
     267 * citations and bibliography (works best in LaTeX using BibTeX)
     268 * math support
     269 * automatic cross-referencing ability
     270 * smart typography, with support for multiple languages
     271 * image attributes
     272 * table and image captions
     273 * definition lists
     274 * glossary entries (LaTeX only)
     275 * document metadata (e.g. title, author, etc.)
     276
     277
     278-----
     279(to be continued)
     280-----
     281== [http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown Pandoc]
     282
     283
     284== [http://www.pell.portland.or.us/~orc/Code/markdown/ Discount]
     285
     286
     287== [http://stackoverflow.com/editing-help StackOverflow extensions]
     288
     289
     290== [http://rdoc.rubyforge.org/RDoc/Markdown.html RDoc Markdown]
     291
     292== [http://www.stack.nl/~dimitri/doxygen/manual/markdown.html Doxygen Markdown]