我打開ckeditor,默認情況下顯示下面的內容。顯示ckeditor中的html標記
<textarea id="editor1" name="editor1" rows="30" cols="120"><p>We can use <strong>prettify </strong>to auto-format the Computer programming code at web page.</p>
<p><strong>How to use?</strong></p>
<p>Just add below line;</p>
<p><code class="prettyprint"><span style="line-height: 1.6em;"><script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script></span></code</p>
<p><span style="line-height: 1.6em;">Then, put the code line in below tab;</span></p>
<p><code class="prettyprint"><code class="prettyprint">...</code></code></p>
<p><span style="color: rgb(0, 0, 0); font-family: monospace; font-size: medium; line-height: normal;">or,</span></p>
<p>Download the complete code files from <a href="https://code.google.com/p/google-code-prettify/">https://code.google.com/p/google-code-prettify/</a>(even can learn more about prettify) to your server and change above script tag line like below;</p>
<p><code class="prettyprint"><script src="path/to/directory/run_prettify.js"></script></code><br /> </p>
</textarea>
<script>CKEDITOR.replace("editor1");</script>
但是,在輸出HTML標記代碼丟失。輸出低於(在行下);
我們可以使用prettify在網頁上自動格式化計算機編程代碼。
如何使用?
只需在下面添加行;
然後,將代碼行放在下面的選項卡中;
...
,或者
從https://code.google.com/p/google-code-prettify/(even下載完整的代碼文件可以瞭解更多有關美化)到您的服務器,並更改上面的腳本標記線像下面;
期待輸出: 請幫幫忙,我很想念這裏。
您是否做了其他設置?你使用的是哪種版本的CKEditor?你如何創建編輯器?如果您可以提供更多信息,maby我們可以幫助.. – spons 2013-04-23 06:31:41
我正在使用4.0.1.1版本。我沒有使用任何其他設置。在ckeditor設置中,我禁用了幾個按鈕,在'計算機代碼'選項'樣式'中添加屬性'class =「prettyprint」'。 – vips 2013-04-23 06:37:40