This module extends the marked
module to my liking.
- highlighting is done by
pygmentize
- In paragraphs,
~
renders to
- In inline code,
~
renders to∼
- Link to external hosts have
target="_blank"
options.highlight
is disabled (too lazy to implement)
npm install pfm
with Jade >= 1.10.0
Use the jstransformer-pfm
module.
Jade deprecated Transformers support in filters in v1.10.0
and will be dropping it in favor of jstransformers
from v2.0.0.
with Jade < 1.10.0
jade = require 'jade'
pfm = require 'pfm'
jade.filters.markdown = pfm
I was recently editing my /about page when I discovered this peculiar piece of jade:
p.
Written in the #[a(href='http://jade-lang.com', target='_blank') jade template engine]
with #[a(href='http://sass-lang.com/', target='_blank') Sass]
and #[a(href='http://coffeescript.org/#literate', target='_blank') literate CoffeScript].
The design is based on the #[a(href='http://lanyon.getpoole.com/', target='_blank') Lanyon]
theme for #[a(href='http://jekyllrb.com/', target='_blank') Jekyll]
, but rewritten from scratch in Sass. The page and blog builder runs
in #[a(href='http://nodejs.org/', target='_blank') Node.js]
and the whole site is put together
by the #[a(href='http://www.gnu.org/software/make/', target='_blank') GNU Make].
It needed to be written like that to produce the desired output (links to outside sources open in a new tab and line splitting behaves nicely). When I rewrote it with the :pfm
filter, well - judge for yourself:
:pfm
Written in~the~[jade template engine](http://jade-lang.com)
with~[Sass](http://sass-lang.com/)
and~[literate CoffeScript](http://coffeescript.org/#literate).
The~design is based on~the~[Lanyon](http://lanyon.getpoole.com/)
theme for~[Jekyll](http://jekyllrb.com/),
but rewritten from~scratch in~Sass. The~page and~blog builder runs
in~[Node.js](http://nodejs.org/)
and~the~whole site is put together
by~the~[GNU Make](http://www.gnu.org/software/make/).
With or without highlighting, the below :pfm
code is easier to read. And readability counts.
Roman Piták made this. Ping me on Twitter —
@RomanPitak — if you're having issues, want me to
merge in your pull request, or are using :pfm
in a cool way. I'm kind of hoping
this is generic enough that people do some fun things with it.