| title | An example Markdown file |
|---|
Here's an inline (code span) directive:
name_of_function{'arg1': 'value', 'arg2': 'value2'}
| import mistune | |
| def main(meta, content, classes=[]): | |
| """Adding classes to a `<p>`. | |
| """ | |
| html = mistune.markdown(content) | |
| return html.replace("<p>", '<p class="{0}">'.format(" ".join(classes))) |
| import mistune | |
| def main(meta, content, level): | |
| """A Bootstrap-style alert. | |
| """ | |
| # We want to be able to write our body content in Markdown, | |
| # so we use the `mistune` library to convert it to HTML. | |
| html = mistune.markdown(content) | |
| return '<div class="alert alert-{0}" role="alert">{1}</div>'.format(level, html) |
| def main(meta, arg1, arg2): | |
| """An example directive. | |
| These functions return a string that replaces the original | |
| directive in the Markdown source file. | |
| `meta` is a dictionary created from front matter (`{}` by | |
| default). In this case, it will be: | |
| {'title': 'An example Markdown file'} |
By including code examples from external sources, we can ensure that they're properly tested, linted, and updated without having to duplicate content.
`document{'path': 'my_file.py', 'span': (10, 13)}`We can include non-code content, too:
document{'path': 'includes/some_file.md'}
| --- | |
| - | |
| age: 90 | |
| first_name: John | |
| last_name: Adams | |
| - | |
| age: 83 | |
| first_name: Henry | |
| last_name: Ford |
| <table class="table"> | |
| <caption>My data</caption> | |
| <thead> | |
| <tr> | |
| <th>age</th> | |
| <th>first_name</th> | |
| <th>last_name</th> | |
| </tr> | |
| </thead> | |
| <tbody> |
| def main(meta, video, clip=[]): | |
| """Example directive for including a YouTube video. | |
| `meta` is a dictionary containing any front matter that was | |
| listed in the Markdown file. | |
| `clip` specifies an optional start and stop point for the video. | |
| """ | |
| link = "https://www.youtube.com/embed/{0}".format(video) | |
| addons | |
| alertmanager | |
| anonymized | |
| arity | |
| autocommit | |
| backfilling | |
| backfills | |
| bitwise | |
| bolded | |
| burstable |
| GitHub Repo | Format | Files | Average Size (lines) | 5-Run Average (seconds) |
|---|---|---|---|---|
| linode / docs | Markdown | 1,067 | 189.376 | 23.713 |
| nltk / nltk_book | reStructuredText | 43 | 833.372 | 18.662 |
| clojure-cookbook | AsciiDoc | 196 | 128.408 | 15.237 |