Skip to content

How to test render custom tag on single post ? #5203

Discussion options

You must be logged in to vote

solved using hexo.loadPlugin and hexo.post.render.

import Hexo from 'hexo';
import path from 'path';

const hexo = new Hexo(__dirname);
async function main() {
  await hexo.init().then(() => hexo.loadPlugin(require.resolve('hexo-shortcodes')));
  await hexo.load(async () => {
    const post = await hexo.post.render(path.join(__dirname, 'source/lang/php.md'));
    console.log(post);
  });
}

main();

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@dimaslanjaka
Comment options

@dimaslanjaka
Comment options

@dimaslanjaka
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@lorezyra
Comment options

@dimaslanjaka
Comment options

@dimaslanjaka
Comment options

@dimaslanjaka
Comment options

@dimaslanjaka
Comment options

Answer selected by dimaslanjaka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants