From ce61e78191d9f4b7a03007d89187c1cc7d6a71f4 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 17 Jun 2016 15:10:50 -0700 Subject: [PATCH] Created Markdown Pages (markdown) --- Markdown-Pages.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Markdown-Pages.md diff --git a/Markdown-Pages.md b/Markdown-Pages.md new file mode 100644 index 0000000..f9498f3 --- /dev/null +++ b/Markdown-Pages.md @@ -0,0 +1,75 @@ +These are some tips and tricks for your Markdown pages (`.md` files). + +Rophako treats Markdown pages as first-class citizens. For example, just like how the `/about` URI on your site can map to an HTML file named `about.html`, you could also have used a Markdown file named `about.md` if you prefer to write some of your pages in Markdown (you can mix and match HTML and Markdown pages within a site, but don't use both for the same page!) + +Rophako includes a minimalistic template at `rophako/www/markdown.inc.html` that simply drops the rendered HTML from the Markdown and sets the page title to match the first header in the Markdown source. You can override the default Markdown template by creating a `markdown.inc.html` in your site's own document root. + +# Default Markdown Extensions + +The following Markdown extensions are **on** by default in Rophako; this applies to all places where Markdown is supported, including blog posts and comments: + +* `fenced_code`: GitHub style code blocks. +* `tables`: Markdown tables, from php-markdown ([information](http://michelf.ca/projects/php-markdown/extra/#table)) +* `smart_strong`: Handles double__underscore better. +* `codehilite`: Highlights source code using Pygments -- useful with GitHub style code blocks. +* `nl2br`: Line breaks inside a paragraph become a literal `
` in the HTML. +* `sane_lists`: Make lists less surprising. + +You can enable or disable extensions on a per-page basis by using "meta" tags in your Markdown files. + +At the very top of your Markdown file, a line beginning with the string `:meta` is a "meta" tag. Example: + +``` +:meta extensions -nl2br headerid +``` + +This example *disables* (note the minus sign) the `nl2br` extension, and *enables* `headerid` (adding HTML anchor IDs to each header). + +See the [Extensions](https://pythonhosted.org/Markdown/extensions/) documentation in the Python Markdown module. + +# Enabling a Table of Contents + +To enable a Table of Contents on one of your Markdown pages, you need to do two things: + +* Enable the `headerid` extension +* Turn on the table of contents setting + +The `headerid` extension generates anchor tags for all the headers on your page, like: + +```html +

Getting Started

+``` + +And the TOC setting tells Rophako to parse the generated HTML to find those anchor tags and create a Table of Contents. + +For a minimal example, put this at the top of your Markdown file: + +``` +:meta extensions headerid +:meta toc on +``` + +Rophako's default Markdown template will generate markup like the following: + +```html + +``` + +The key classes: + +* `.markdown-toc`: the wrapper for the entire Table of Contents nav object, so you can style this however you want, e.g. place it in a fixed side bar. +* `.toc-1` through `.toc-6`: these correspond to the header level of the item (`

` through `

`) so you can style them appropriately (e.g. indent the subheaders) + +The default Rophako web design doesn't contain any special classes for Table of Contents, so you should implement these for your own site's theme. \ No newline at end of file