]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/Fenced_code_blocks___40__from_GitHub_Flavored_Markdown__41__.mdwn
update for rename of todo/org_mode.mdwn to plugins/contrib/org_mode.mdwn
[ikiwiki.git] / doc / todo / Fenced_code_blocks___40__from_GitHub_Flavored_Markdown__41__.mdwn
1 GitHub's flavor of markdown adds fenced code blocks, delimited by triple-backquotes, like this:
2
3     ```
4     code
5     more code
6     ```
7
8 That syntax proves quite a bit more convenient in many cases, because it doesn't require modifying every line of the code block to add indentation.  Please consider adding optional support for this in ikiwiki.  Please also consider turning it on by default for new wikis, though not for existing wikis since it could *potentially* break backward compatibility with existing content.
9
10 > I don't think that's an official markdown feature, although it might be available
11 > as an extension in some markdown library or other -- possibly one of the ones
12 > supported by ikiwiki.
13
14 > However, aside from compatability, ikiwiki already provides a way to do it that does not
15 > require indenting the code: The [[ikiwiki/directive/format]] directive. Which has the benefit of
16 > also telling it what kind of code it is, so it can syntax highlight it. Example:
17
18 [[!format haskell """
19 main :: IO ()
20 main = forever $
21   putStrLn "hello, world!"
22 """]]
23
24 > --[[Joey]]
25
26 > > It is not a standard feature (as much as Markdown is [[standardized|Track_Markdown_Standardisation_Efforts]]...) But it does allow for [syntax hilightning](https://help.github.com/articles/github-flavored-markdown) too, just tag the language name after the backticks. It *seems* that Discount supports github-style backtick format (as well as Pandoc `~~~~` format) but doesn't allow the keyword argument.
27 > > 
28 > > I strongly support this feature. --[[anarcat]]
29 > > 
30 > > In fact, it turns out that it already works here!
31 > >
32 > > ~~~~
33 > > this is a pandoc-style fenced in code block
34 > > this is another line
35 > > ~~~~
36 > > 
37 > > github-style backticks, however, do not add a wrapping `<pre>` block for some reason:
38 > >
39 > > ```
40 > > this is a github-style fenced in code block
41 > > this is another line
42 > > ```
43 > >
44 > > ... maybe a bug in Discount... --[[anarcat]]
45
46 > > > Discount versions older than 2.1.6 do not support the \`\`\` fences.
47 > > > ikiwiki.info (hosted by branchable.com) presumably runs on Debian
48 > > > stable, which only has 2.1.3. I am not involved in running Branchable,
49 > > > but it seems reasonable to assume that it will be upgraded to 2.1.7
50 > > > as part of upgrading to Debian 8 when that is released. --[[smcv]]
51
52 > > I strongly support this feature as well! --[[integrii]]
53
54 > > > ikiwiki has no support for specific Markdown features: all it does
55 > > > is to recognise a Markdown file and give it to a Markdown
56 > > > implementation such as [[!cpan Text::Markdown::Discount]].
57 > > > If you would like ikiwiki to support a different subset of Markdown,
58 > > > please either recommend a better Markdown implementation, or
59 > > > report bugs / feature requests to the maintainer of Discount.
60 > > >
61 > > > In this case it appears there is no code change required in
62 > > > ikiwiki (and for that matter, nothing to do in Discount either
63 > > > because the feature request has already been implemented),
64 > > > so I'm [[closing this todo item|done]]. --[[smcv]]