]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/Fenced_code_blocks___40__from_GitHub_Flavored_Markdown__41__.mdwn
todo entry
[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]]