Skip to content

Commit

Permalink
refactor: drop gist tag (#5067)
Browse files Browse the repository at this point in the history
* refactor: drop `gist` tag

* restore needed test fixture
  • Loading branch information
yoshinorin authored Oct 5, 2022
1 parent 8aac336 commit 1127f0b
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 71 deletions.
17 changes: 0 additions & 17 deletions lib/plugins/tag/gist.js

This file was deleted.

2 changes: 0 additions & 2 deletions lib/plugins/tag/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ module.exports = ctx => {
tag.register('code', code, true);
tag.register('codeblock', code, true);

tag.register('gist', require('./gist'));

tag.register('iframe', require('./iframe'));

const img = require('./img')(ctx);
Expand Down
18 changes: 0 additions & 18 deletions test/fixtures/post_render.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,6 @@ exports.expected_for_issue_3346 = [
'</blockquote>'
].join('');

exports.content_for_issue_4317 = [
'```sh',
'echo "Hi"',
'',
'```',
'{% gist gist_id %}',
'',
'```sh',
'echo "Hi"',
'```',
'',
'{% gist gist_id_2 %}',
'',
'```sh',
'echo "Hi"',
'```'
].join('\n');

exports.content_for_issue_4460 = [
'```html',
'<body>',
Expand Down
17 changes: 1 addition & 16 deletions test/scripts/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { join } = require('path');
const moment = require('moment');
const { readFile, mkdirs, unlink, rmdir, writeFile, exists, stat, listDir } = require('hexo-fs');
const { highlight, escapeHTML } = require('hexo-util');
const { highlight } = require('hexo-util');
const { spy, useFakeTimers } = require('sinon');
const { parse: yfm } = require('hexo-front-matter');
const fixture = require('../../fixtures/post_render');
Expand Down Expand Up @@ -1205,21 +1205,6 @@ describe('Post', () => {
data.content.trim().should.eql(`<p><code>${escapeSwigTag('{{ 1 + 1 }}')}</code> 2</p>`);
});

// #4317
it('render() - issue #4317', async () => {
const content = fixture.content_for_issue_4317;
hexo.config.highlight.enable = false;

const data = await post.render(null, {
content,
engine: 'markdown'
});

data.content.trim().should.contains(`<pre><code class="sh">${escapeHTML('echo "Hi"')}\n</code></pre>`);
data.content.trim().should.contains('<script src="//gist.github.com/gist_id.js"></script>');
data.content.trim().should.contains('<script src="//gist.github.com/gist_id_2.js"></script>');
});

// #3543
it('render() - issue #3543', async () => {
// Adopted from #3459
Expand Down
17 changes: 0 additions & 17 deletions test/scripts/tags/gist.js

This file was deleted.

1 change: 0 additions & 1 deletion test/scripts/tags/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ describe('Tags', () => {
require('./asset_path');
require('./blockquote');
require('./code');
require('./gist');
require('./iframe');
require('./img');
require('./include_code');
Expand Down

0 comments on commit 1127f0b

Please sign in to comment.