转义<>和@中的字符 tags

问题描述 投票:0回答:1

我有以下HTML:

<h3 id="concat">Concat</h3>
<p><a name="abcde"></a></p>
<pre lang="java" class="prettyprint">

 class NeoEach {

   static {@code <T, V, E> void Each(int limit, Iterable<T> i, Asyncc.IEacher<T, E> m, Asyncc.IEachCallback<E> f)} {

     final CounterLimit c = new CounterLimit(limit);
     final ShortCircuit s = new ShortCircuit();
     final var iterator = i.iterator();
     RunEach(iterator, c, s, m, f);
     handleSameTickCall(s);
   }

 }
</pre>

<h3 id="series">Series</h3>
<p><a name="abcde"></a></p>
<pre lang="java" class="prettyprint">

 class NeoEach {

   static {@code <T, V, E>} void Each(int limit, Iterable<T> i, Asyncc.IEacher<T, E> m, Asyncc.IEachCallback<E> f) {

     final CounterLimit c = new CounterLimit(limit);
     final ShortCircuit s = new ShortCircuit();
     final var iterator = i.iterator();
     RunEach(iterator, c, s, m, f);
     handleSameTickCall(s);
   }

 }
</pre>

<h3 id="parallel">Parallel</h3>
<p><a name="abcde"></a></p>
<pre lang="java" class="prettyprint">

 class NeoEach {

   static <T, V, E> void Each(int limit, Iterable<T> i, Asyncc.IEacher<T, E> m, Asyncc.IEachCallback<E> f) {

     final CounterLimit c = new CounterLimit(limit);
     final ShortCircuit s = new ShortCircuit();
     final var iterator = i.iterator();
     RunEach(iterator, c, s, m, f);
     handleSameTickCall(s);
   }

 }
</pre>

它显示如下:

enter image description here

你可以看到我试图使用{@code}来逃避<>字符,但是它不起作用。

有谁知道为什么它不能逃脱角色并正确格式化?

html html5 pre
1个回答
0
投票

你可以使用&lt;作为'&gt;'。

<h3 id="concat">Concat</h3>
    <p><a name="abcde"></a></p>
    <pre lang="java" class="prettyprint">
  
     class NeoEach {
    
       static {&lt;T, V, E&gt; void Each(int limit, Iterable<T> i, Asyncc.IEacher<T, E> m, Asyncc.IEachCallback<E> f)} {
    
         final CounterLimit c = new CounterLimit(limit);
         final ShortCircuit s = new ShortCircuit();
         final var iterator = i.iterator();
         RunEach(iterator, c, s, m, f);
         handleSameTickCall(s);
       }
    
     }
    </pre>
    
    <h3 id="series">Series</h3>
    <p><a name="abcde"></a></p>
    <pre lang="java" class="prettyprint">
    
     class NeoEach {
    
       static {&lt;T, V, E&gt;} void Each(int limit, Iterable<T> i, Asyncc.IEacher<T, E> m, Asyncc.IEachCallback<E> f) {
    
         final CounterLimit c = new CounterLimit(limit);
         final ShortCircuit s = new ShortCircuit();
         final var iterator = i.iterator();
         RunEach(iterator, c, s, m, f);
         handleSameTickCall(s);
       }
    
     }
    </pre>
    
    <h3 id="parallel">Parallel</h3>
    <p><a name="abcde"></a></p>
    <pre lang="java" class="prettyprint">
    
     class NeoEach {
    
       static &lt;T, V, E&gt; void Each(int limit, Iterable<T> i, Asyncc.IEacher<T, E> m, Asyncc.IEachCallback<E> f) {
    
         final CounterLimit c = new CounterLimit(limit);
         final ShortCircuit s = new ShortCircuit();
         final var iterator = i.iterator();
         RunEach(iterator, c, s, m, f);
         handleSameTickCall(s);
       }
    
     }
    </pre>
© www.soinside.com 2019 - 2024. All rights reserved.