I have made my onw jekyll plugin which gives some text special css (spoiler hider).
This is my code:
class Spoiler < Liquid::Tag
def initialize(tag_name, input, tokens)
super
@input = input
end
def render(context)
output = "<div class='spoiler'>" + @input + "<div>"
return output;
end
end
Liquid::Template.register_tag('spoiler', Spoiler)
There is example how I want to use it in my markdown posts:
---
layout: post
title: "testing file"
date: 2019-09-25
category: article
---
aaaaaaaaaaa {% spoiler secret text %} bbbbbbbbbbbb
but this is how page looks like:
When I look in to generated source code, the text looks like this:
<p>aaaaaaa <div class='spoiler'>secret text </div> bbbbbbbb</p>
What should I do make jekyll plugin generate html element instead of text ?
PS: If I manually replace <
by <
and >
by >
, it works fine.
` tags.. If you want to handle this entirely via plugins, you'll have to drop using Liquid Tag and instead rely on string substitution via the `post_render` hook. You may want to look at the source code for `jemoji` plugin for reference.
– ashmaroli Nov 04 '19 at 13:40