如何在浏览器中将标签呈现为html

时间:2012-05-01 17:44:29

标签: html tags rendering

如何在浏览器中将这些标记呈现为html,例如:铬?

<testname=tar_tests.sh>
    <description>
        Test basic functionality of `tar` command.
    <\description>
    <test_location>
        ltp/testcases/commands/tar/tar_tests.sh
    <\test_location>
<\testname>

<testname=unzip>
    <description>
        Test basic functionality of `unzip` command.

    <\description>
    <test_location>
        ltp/testcases/commands/unzip
    <\test_location>
<\testname>

输出:

<testname=tar_tests.sh> <description> Test basic functionality of `tar` command. <\description> <test_location> ltp/testcases/commands/tar/tar_tests.sh <\test_location> <\testname> <testname=unzip> <description> Test basic functionality of `unzip` command. <\description> <test_location> ltp/testcases/commands/unzip <\test_location> <\testname>

3 个答案:

答案 0 :(得分:3)

您需要为括号使用HTML实体。将<更改为&lt;,将>更改为&gt;

答案 1 :(得分:2)

您需要将<>字符分别转义为&lt;&gt;

因此,在您的HTML中,为了显示:

<testname=tar_tests.sh>

你应该写:

&lt;testname=tar_tests.sh&gt;

答案 2 :(得分:0)

如果您将文本包装在<pre> ... </pre>中,它将被格式化,您无需将所有标记更改为HTML实体。保留空白和布局。

<pre>
&lt;testname=tar_tests.sh>
...
</pre>
相关问题