From a433b1eaa7abc457c5f8f6107cef20853e3acdc2 Mon Sep 17 00:00:00 2001 From: Brian Mann Date: Tue, 13 Jun 2017 11:12:30 -0400 Subject: [PATCH] docs: create a partial tag helper to include shared markdown files --- docs/scripts/tags.js | 7 +++++++ docs/source/_partial/then_should_difference.md | 7 +++++++ docs/source/api/commands/and.md | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 docs/source/_partial/then_should_difference.md diff --git a/docs/scripts/tags.js b/docs/scripts/tags.js index e30b5edd40..d9878542fd 100644 --- a/docs/scripts/tags.js +++ b/docs/scripts/tags.js @@ -1,4 +1,5 @@ 'use strict' +const path = require('path') const util = require('hexo-util') const urlGenerator = require('../lib/url_generator') @@ -107,3 +108,9 @@ hexo.extend.tag.register('url', function (args) { }) }, { async: true }) + +hexo.extend.tag.register('partial', (fileName) => { + const pathToFile = path.resolve('source', '_partial', `${fileName}.md`) + + return hexo.render.render({ path: pathToFile, engine: 'markdown' }) +}, { async: true }) diff --git a/docs/source/_partial/then_should_difference.md b/docs/source/_partial/then_should_difference.md new file mode 100644 index 0000000000..bf39142d0c --- /dev/null +++ b/docs/source/_partial/then_should_difference.md @@ -0,0 +1,7 @@ +all the differences in markdown + +*** + +asdfkljasdfl + +## foo diff --git a/docs/source/api/commands/and.md b/docs/source/api/commands/and.md index b6df4b4d66..31d5f12d68 100644 --- a/docs/source/api/commands/and.md +++ b/docs/source/api/commands/and.md @@ -3,6 +3,8 @@ title: and comments: true --- +{% partial then_should_difference %} + Make an assertion. {% note info %}