Closed KumaNNN closed 4 years ago
_config.yml
anchors: permalinkSide: 'right'
Expected results(预期的结果)
Actual results(实际的结果)
Fix in hexo-renderer-markdown-it\lib\anchors.js
hexo-renderer-markdown-it\lib\anchors.js
修复在 hexo-renderer-markdown-it\lib\anchors.js
//Old const renderPermalink = function(slug, opts, tokens, idx) { const permalink = [Object.assign(new Token('link_open', 'a', 1), { attrs: [['class', opts.permalinkClass], ['href', '#' + slug]] }), Object.assign(new Token('text', '', 0), { content: opts.permalinkSymbol }), new Token('link_close', 'a', -1), Object.assign(new Token('text', '', 0), { content: '' })];
//New const renderPermalink = function(slug, opts, tokens, idx) { if (opts.permalinkSide === 'right') { var floatStr = 'none'; } else { var floatStr = opts.permalinkSide; } const permalink = [Object.assign(new Token('link_open', 'a', 1), { attrs: [['class', opts.permalinkClass], ['href', '#' + slug], ['style', 'float: ' + floatStr]] }), Object.assign(new Token('text', '', 0), { content: opts.permalinkSymbol }), new Token('link_close', 'a', -1), Object.assign(new Token('text', '', 0), { content: '' })];
Results(结果)
https://github.com/hexojs/hexo-renderer-markdown-it/pull/119#issuecomment-671650546
Problem
_config.yml
Expected results(预期的结果)![2](https://user-images.githubusercontent.com/31473722/89286284-7d092580-d684-11ea-94b6-0d482bb6b648.jpg)
Actual results(实际的结果)![1](https://user-images.githubusercontent.com/31473722/89286267-75498100-d684-11ea-9c9c-9a05ee201b98.jpg)
Fix
Fix in
hexo-renderer-markdown-it\lib\anchors.js
修复在
hexo-renderer-markdown-it\lib\anchors.js
Results(结果)![3](https://user-images.githubusercontent.com/31473722/89286236-68c52880-d684-11ea-9aec-9ace95932582.jpg)