Hexo: Markdown string in tag?

Created on 18 Dec 2016  路  1Comment  路  Source: hexojs/hexo

How do I convert string content to markdown in a tag?

{% custom %}
Make text **markdown**
{% endcustom %}
hexo.extend.tag.register('custom', function(args, content) {
  // render content in markdown before return
  return '<blockquote>' + content + '</blockquote>';
}, {ends: true});

Right now the above returns:

<blockquote>Make text **markdown**</blockquote>

And I want it to return this:

<blockquote>Make text <strong>markdown</strong></blockquote>

Most helpful comment

I figured it out.

hexo.extend.tag.register('custom', function(args, content) {
  content = hexo.render.renderSync({text: content, engine: 'markdown'});

  return '<blockquote>' + content + '</blockquote>';
}, {ends: true});

>All comments

I figured it out.

hexo.extend.tag.register('custom', function(args, content) {
  content = hexo.render.renderSync({text: content, engine: 'markdown'});

  return '<blockquote>' + content + '</blockquote>';
}, {ends: true});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  27Comments

fishercoder1534 picture fishercoder1534  路  26Comments

fabien-h picture fabien-h  路  22Comments

scaljeri picture scaljeri  路  44Comments

pod4g picture pod4g  路  24Comments