instant-markdown-d icon indicating copy to clipboard operation
instant-markdown-d copied to clipboard

Feature Request: could we ignore the YAML meta block in the markdown?

Open hitzhangjie opened this issue 3 years ago • 3 comments

Problem summary

Hi, there're some markdown editors or github, they require or encourage users to write some liquid tags in the document. For example, we could write author, description, tags, then the static site generate like hugo can extract this kind of info to build a static site.

Sometimes, when we edit the file in vim + instant-markdown-d, when rendering, the liquid tags will be treated like normal text. I think we should ignore this part or render it in some fancy way.

Expected

Ignore the liquid tags or render it in some fancy way.

Example

here's a markdown with liquid tags:

image

it will be rendered like this so far:

image

hitzhangjie avatar Jun 26 '22 07:06 hitzhangjie

If this PR is welcome, I think I could submit a PR.

hitzhangjie avatar Jun 26 '22 07:06 hitzhangjie

Sure! Contributions welcome.

BTW, I think that is called a YAML metadata block. Liquid tags are a templating system some markdown engines uses.

ashwinvis avatar Jun 28 '22 20:06 ashwinvis

Yes, it is called a YAML metadata block.


I debugged the vim-instant-markdown plugin just now, I saw the MD buffer sent is OK. The data sent is ---@layout: post....---, it's OK. The index.js got the data newHTML is <hr>\n.....<h2>layout: post...</h2>, so I think we could simply trim the substring from the beginning.

hitzhangjie avatar Jun 29 '22 07:06 hitzhangjie

Done in #95

ashwinvis avatar Sep 30 '23 22:09 ashwinvis