Browse Source

RSS summary and markdown tables/footnotes

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
32e8c07272
3 changed files with 10 additions and 3 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +6
    -2
      src/markdown.rs
  3. +1
    -1
      src/templates/rss.xml

+ 3
- 0
CHANGELOG.md 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


+ 6
- 2
src/markdown.rs 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 {


+ 1
- 1
src/templates/rss.xml 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>


Loading…
Cancel
Save