-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(highlight): adjust the layout of the highlight code block #132
Conversation
Currently I am working on a new Hexo theme, and highlight style problem just nearly makes me mad. I am sure this PR would help, but I am wonder if this will significantly increase output HTML size. |
Also, the test case needs to be updated in order to pass the Travis CI test. |
Travis CI's error report has been fixed. The main idea of this PR is: it's a bit strange to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in local machine.
@SukkaW @curbengh @jiangtj Lines 61 to 72 in e736e1b
And here's the solution - it's necessary to insert a function formatLine(line, lineno, marked, options) {
+ line = line || '<br>';
const useHljs = options.hljs || false;
let res = useHljs ? '' : '<span class="line';
if (marked.includes(lineno)) {
// Handle marked lines.
res += useHljs ? `<mark>${line}</mark>` : ` marked">${line}</span>`;
} else {
res += useHljs ? line : `">${line}</span>`;
}
return res;
} |
I see, I was wondering why empty line is removed in https://deploy-preview-1241--hexo-site.netlify.com/news/2019/12/09/hexo-4-1-released/ when previewing hexojs/site#1241 . hexo website does disabled Please submit a PR. Need to make sure it's compatible with the following configs: # Need a unit test for this config in that PR, the rest can test on sample blog
highlight:
line_number: false
wrap: true highlight:
line_number: false
wrap: false # they are decoupled after #138
highlight:
hljs: false
wrap: true highlight:
hljs: false
wrap: false |
Current behavior
New behavior