RSS summary and markdown tables/footnotes

This commit is contained in:
Vincent Prouillet 2017-04-19 22:16:21 +09:00
parent 9acb70442f
commit 32e8c07272
3 changed files with 10 additions and 3 deletions

View file

@ -7,6 +7,9 @@
- Add id to headers to allow anchor linking
- Make relative link work with anchors
- Add option to render an anchor link automatically next to headers
- Only copy the static files that changed, not the whole directory in `gutenberg serve`
- Use summary if available in RSS feed
- Add tables and footnotes support in markdown
## 0.0.3 (2017-04-05)
- Add some colours in console

View file

@ -2,7 +2,7 @@ use std::borrow::Cow::Owned;
use std::collections::HashMap;
use pulldown_cmark as cmark;
use self::cmark::{Parser, Event, Tag};
use self::cmark::{Parser, Event, Tag, Options, OPTION_ENABLE_TABLES, OPTION_ENABLE_FOOTNOTES};
use regex::Regex;
use slug::slugify;
use syntect::dumps::from_binary;
@ -138,8 +138,12 @@ pub fn markdown_to_html(content: &str, permalinks: &HashMap<String, String>, ter
find_anchor(anchors, name, level + 1)
}
let mut opts = Options::empty();
opts.insert(OPTION_ENABLE_TABLES);
opts.insert(OPTION_ENABLE_FOOTNOTES);
{
let parser = Parser::new(content).map(|event| match event {
let parser = Parser::new_ext(content, opts).map(|event| match event {
Event::Text(text) => {
// if we are in the middle of a code block
if let Some(ref mut highlighter) = highlighter {

View file

@ -13,7 +13,7 @@
<pubDate>{{ page.date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
<link>{{ page.permalink }}</link>
<guid>{{ page.permalink }}</guid>
<description>{{ page.content }}</description>
<description>{% if page.summary %}{{ page.summary }}{% else %}{{ page.content }}{% endif %}</description>
</item>
{% endfor %}
</channel>