We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如图,看代码不够美观
The text was updated successfully, but these errors were encountered:
这个不太好实现. rss 内容一般是去掉了 css 和 js 的 html, 因为 html 格式没有统一的规范, 很难判断哪部分是代码, 更难判断是什么语言. 不过如果你知道有什么 (开源的) 阅读器有这个功能的话, 也可以让我参考下.
Sorry, something went wrong.
穷举法?其实也不多,看了下,大概有这两种:
<code> ... </code> <code class="language-go"> ... </code> <code class="language-javascript"> ... </code>
<pre> ... </pre> <pre data-enlighter-language="java"> ... </pre>
这种靠 "猜" 的思路不太对吧, 肯定远不止这两种. 这种格式没有统一标准, 不同的网站格式都五花八门. 虽然代码一般会放在 <code> 或 <pre> 里, 但是结构也是五花八门的, 比如有的会使用两栏 <table> 然后第一栏做行号. 至于代码的语言更是奇奇怪怪, 所用的属性 (class 或是自定义属性), 属性的位置 (有些是在 <code> 上有些是在外围的 <div> 上), 属性的值 (可能是 "language-java", 或者 "lang-java" 或者 "java") 等等... 现在的一些 html 转 markdown 的工具能够提取出代码, 但也无法推测出语言. 总之, 我个人认为这件事实在是费力不讨好 😂. 其实我觉得解决这个问题最简单的方法就是点击右下角的 "Open link", 也尊重下作者嘛, 为人家的网站带来一点访问量.
<code>
<pre>
<table>
class
<div>
"language-java"
"lang-java"
"java"
No branches or pull requests
如图,看代码不够美观
The text was updated successfully, but these errors were encountered: