<code> 不忽略所有代码
<code> doesn't ignore all code
我想在我的 html 文档中插入代码片段,但是
<code></code>
标签似乎无法修复非html 代码。例如,我正在尝试插入此代码段:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent”
android:orientation:”vertical”
tools:context=".LinearLayout" >
</LinearLayout>
但它根本不显示代码段。
<code>
标记不会影响嵌套 HTML 的解析方式,并且它们不会对 HTML 实体进行编码。随你(由你决定。如果您想显示文字 <html>
标签,无论它们是否在 <code>
标签中,您都需要使用 <html>
。否则,它们被解析为 HTML 标签。
例如这个片段...
<code><h1>heading</h1></code>
生成此输出:
<h1>标题</h1>
要实际输出文字字符串<h1>heading</h1>
,你需要:
<code><h1>heading</h1></code>
输出:
<h1>heading</h1>
我想在我的 html 文档中插入代码片段,但是
<code></code>
标签似乎无法修复非html 代码。例如,我正在尝试插入此代码段:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent”
android:orientation:”vertical”
tools:context=".LinearLayout" >
</LinearLayout>
但它根本不显示代码段。
<code>
标记不会影响嵌套 HTML 的解析方式,并且它们不会对 HTML 实体进行编码。随你(由你决定。如果您想显示文字 <html>
标签,无论它们是否在 <code>
标签中,您都需要使用 <html>
。否则,它们被解析为 HTML 标签。
例如这个片段...
<code><h1>heading</h1></code>
生成此输出:
<h1>标题</h1>
要实际输出文字字符串<h1>heading</h1>
,你需要:
<code><h1>heading</h1></code>
输出:
<h1>heading</h1>