Closed xu-song closed 5 years ago
Add the following css might work:
pre .bash_symbol {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
thanks. Actually, css is not the key point. The main issue might be the code block render.
In ivan's pages
<code class="bash">
<span class="bash_symbol">$ </span>
<span class="built_in">yum</span>
install vsftpd
</code>
The default render is tomorrow-theme
# Code Highlight theme
# https://github.com/chriskempson/tomorrow-theme
highlight_theme: normal
In the default render, I get the following output
<td class="code">
<pre>
<span class="line">
$ hexo new
<span class="string">"My New Post"</span>
</span>
</pre>
</td>
Yes, it's need to do in Hexo javascript file + NexT css files. I actually don't remember what i edit for that, but i can find it and want to try implement this feature in NexT or in Hexo with option on it.
Feature look's like this:
In MD file:
yum install vsftpd
Will automatically render in HTML to:
Thanks
Try this:
$(".line").each(function(i, o) {
str = $(o).html();
if (str.substring(0, 2) == "$ ") {
$(o).html('<span style="user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;">$ </span>' + str.substring(2));
}
});
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stevenjoezhang there is not only in Hexo need to be added. Some CSS need to add too. For now no need to think about this feature, I'll think about this later.
https://github.com/highlightjs/highlight.js/issues/1486
@xu-song @ivan-nginx Use shell
instead of bash
, sh
or zsh
Reverted in next-theme/hexo-theme-next@9fdaba2
@maple3142 Thanks. Your comment there in https://github.com/theme-next/hexo-theme-next/issues/448#issuecomment-431677117 helped me a lot, even though I have no clue what the hexo-theme-next
is all about. :joy: :+1:
Note to hugo users who might be redirected here: If you use console
, bash-session
or shell-session
as the language, $
signs will have a class called gp
which you can use as the CSS selector to follow the solution in https://github.com/theme-next/hexo-theme-next/issues/448#issuecomment-431677117
For more info refer to https://github.com/alecthomas/chroma/issues/184 and https://github.com/alecthomas/chroma/pull/551.
markdownlint recommends that don't use dollar signs before commands without showing output.
https://github.com/DavidAnson/markdownlint/blob/main/doc/md014.md
GitHubA Node.js style checker and lint tool for Markdown/CommonMark files. - DavidAnson/markdownlint
I agree and want to create new issue
Actual behavior
In common, if you
select all
in the code block, the$
will be included.Expected behavior
demo link: https://almostover.ru/2016-10/centos-ftp-server-install/
How can I get the style like @ivan-nginx?