1
4

1 に答える 1

2

私はそれを考え出した。この問題は、jQuery がスイープし、タグ キャレットを同等の Unicode に置き換えているときに発生していました。

これが私の解決策です。マークアップ ブロックをオンザフライで追加することにしたので、各ライブ サンプル ブロックの後に div を追加し、ライブ サンプルのコードを HTML ではなくテキストとして入力していることがわかります (これがトリックでした)。それを機能させるために)<pre> 、それをタグでラップします。

// Add a markup block after each live example container
$('.live-example').after("<div class='markup'></div>");

// Fill the markup block with the code from the live container
$('.live-example').each(function () {
    $(this).next($('.markup')).text($(this).html());
});

// Wrap the code in the markup block with a <pre> tag for prettyprinting
$('.markup').wrapInner('<pre class="prettyprint linenums" />');

<br>コードの前後でまだおかしくなっていますが、対処できます。

結果:

ここに画像の説明を入力

于 2013-05-26T06:02:35.603 に答える