instant-markdown / instant-markdown-d

Small instant Markdown preview server
https://instant-markdown.github.io
Other
189 stars 103 forks source link

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

Closed hitzhangjie closed 1 year ago

hitzhangjie commented 2 years ago

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 commented 2 years ago

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

ashwinvis commented 2 years ago

Sure! Contributions welcome.

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

hitzhangjie commented 2 years ago

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.

ashwinvis commented 1 year ago

Done in #95