Passing Markdown Content to Ruby with Jekyll / Liquid

I am trying to write a jekyll plugin that will take a normal markup file and provide some additional functionality on top of it. In particular, I need to do some (not really) fancy things with tables. I know you can write straight HTML to a markup file, but there is a requirement to prevent content users from wanting / unable to edit HTML.

As an additional key in working, mobile layout has a UX requirement, which is essentially to render the table as a group of divs, not a table.

My initial thought was to pass the {{page.content}} variable into a ruby ​​function that extends Liquid :: Tag. From there I was planning on parsing the markdown file and either: 1. If normal markdown without table, use as usual 2. If table markdown is specified, find the custom id in markdown method, do what needs to be done (like add class, etc.) ).

If I do something like this:

def render(context)
    content = Liquid::Template.parse(@markup).render context
end

      

It displays the context as a normal markup file. However, I want to split the context variable and work with the fragments before rendering. I've tried several different approaches that I got from the jekyll docs and didn't go anywhere.

Does anyone have any experience? Am I on the right track? For what it's worth, Ruby / Jekyll / Liquid is pretty new to me, so if you think I might have missed something basic and obvious enough, then please let me know.

+3


source to share


1 answer


Markup table tool for editors!



I don't know of any other way to make it easier to work on the Jekyll revision, but I would be very interested in receiving from your project. Good luck.

+2


source







All Articles