From 10fcb3a7215a42b4a57c98c8ce3864262981d254 Mon Sep 17 00:00:00 2001 From: Mark Crossfield Date: Thu, 14 Nov 2019 17:12:18 +0000 Subject: [PATCH] Fixes #31: indented items render as fragments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes an issue where if you indented an item and used the `+` sign to make it a fragment, it would simply appear when it’s parent item was shown. I don’t know why I was using `replace_first` and then `prepend` as it seems simpler to just use `replace_first` as I have now. This preserves the indent whitespace of the list item and seems to work properly. --- _layouts/reveal.html | 5 ++--- _posts/0000-01-03-fragments.md | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_layouts/reveal.html b/_layouts/reveal.html index f5beadc..c04a143 100644 --- a/_layouts/reveal.html +++ b/_layouts/reveal.html @@ -62,14 +62,13 @@ | replace:'','' %}{% - assign first_char = line + assign first_char = line | strip | slice: 0,1 %}{% if first_char == '+' %}{% assign processed_line = processed_line - | replace_first: '+','' - | prepend: '+ ' + | replace_first: '+','+ ' %}{% endif %}{{ processed_line }}{% comment %}Following line break is important{% endcomment %} diff --git a/_posts/0000-01-03-fragments.md b/_posts/0000-01-03-fragments.md index ddffca3..cae288c 100644 --- a/_posts/0000-01-03-fragments.md +++ b/_posts/0000-01-03-fragments.md @@ -6,5 +6,6 @@ It's also possible to do fragments. `+ This is a fragment` + This is a fragment + Your fragment may contain the ‘+’ character + + You can also indent fragments You can use <fragment/> to step other content. \ No newline at end of file