MediaWiki 中的缩进代码
是否可以使用 SyntaxHighlight GeSHi 缩进 MediaWiki 中的代码块?
第三级列表对齐
* This is plain text of a first-level list to be rendered by MediaWiki
** This is plain text of a a second-level list to be rendered by MediaWiki
*** This is plain text of a third-level list to be rendered by MediaWiki
<source lang="Cpp">
int main(int argc, char** argv)
{
my_function(4, 1, 2, 3);
return 0;
}
</source>
例如,我希望下面的代码容器与我尝试用 冒号(使用 MediaWiki 的标准缩进语法),但这会阻止 SyntaxHighlight GeSHi 正确解析代码。
只是为了澄清,我想避免用
包装我的代码,因为我需要正确的语法突出显示。
有什么建议吗?
Is it possible to indent a block of code in MediaWiki using SyntaxHighlight GeSHi?
For example, I would like the code container below to be aligned with the third-level list
* This is plain text of a first-level list to be rendered by MediaWiki
** This is plain text of a a second-level list to be rendered by MediaWiki
*** This is plain text of a third-level list to be rendered by MediaWiki
<source lang="Cpp">
int main(int argc, char** argv)
{
my_function(4, 1, 2, 3);
return 0;
}
</source>
I have tried wrapping the GeSHi code container with colons (using MediaWiki's standard indentation syntax), but that prevents SyntaxHighlight GeSHi from parsing the code correctly.
Just to clarify, I would like to avoid wrapping my code with <code></code>
as I need proper syntax highlighting.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你也可以用普通的 HTML div 标签来包装它:
You could always wrap it with normal HTML div tags as well:
您可以将源放入表格中,然后缩进表格:
You can put the source inside a table, and then indent the table:
也许有一种方法可以滥用
...
HTML 元素?可能的解决方法(由 Jeremy Koppel)在 Meta、WikiMedia、Help:Editing FAQ 中给出在问题的答案中我可以将预格式化文本放入编号列表中吗?< /a>:
我在基于 WikiMedia 的 wiki 中成功地使用了它,在带项目符号的文本行下突出显示 bash 代码,如下所示:
但未能成功使其适用于更深层次!
Maybe there is a way to misuse the
<ul>...</ul>
HTML element? A possible workaround is given (by Jeremy Koppel) at Meta, WikiMedia, Help:Editing FAQ among the answers to the question Can I put preformatted text inside a numbered list?:I successfuly used this, in a WikiMedia based wiki, to highlight bash code under a bulleted text line, as follows:
Did not succeed to make it work for deeper levels though!