0

WMD Editor を使用しており、追加したいwmd_options = {"output": "Markdown"};

タグの前に次の行があります。

<script type="text/javascript" src="../wmd/wmd.js"></script>

この行を追加する方法を理解したいです。

wmd_options = {"output": "Markdown"}; 

私はJavaScriptを使うのがあまり得意ではありません。これを使用するのを手伝ってください。

ありがとう

4

2 に答える 2

4
<script type="text/javascript">
wmd_options = {"output": "Markdown"}; 
</script>
<script type="text/javascript" src="../wmd/wmd.js"></script>

Javascript は、ページに含まれている順序 (上から下) でコードを実行します。そのため、wmd.js ファイル内のコードを実行する前に、最初に wmd_options を設定する必要があります。

于 2011-01-28T19:51:30.827 に答える
0

wmd.js を開きます。

このセクションを探します。

// -------------------------------------------------------------------
//  YOUR CHANGES GO HERE
//
// I've tried to localize the things you are likely to change to 
// this area.
// -------------------------------------------------------------------

// The text that appears on the upper part of the dialog box when
// entering links.
var imageDialogText = "<p style='margin-top: 0px'><b>Enter the image URL.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://wmd-editor.com/images/cloud1.jpg   \"Optional title\"</p>";
var linkDialogText = "<p style='margin-top: 0px'><b>Enter the web address.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://wmd-editor.com/   \"Optional title\"</p>";

// The default text that appears in the dialog input box when entering
// links.
var imageDefaultText = "http://";
var linkDefaultText = "http://";

// The location of your button images relative to the base directory.
var imageDirectory = "images/";

// Some intervals in ms.  These can be adjusted to reduce the control's load.
var previewPollInterval = 500;
var pastePollInterval = 100;

// The link and title for the help button
var helpLink = "http://wmd-editor.com/";
var helpHoverTitle = "WMD website";
var helpTarget = "_blank";

var wmd_options = {"output": "Markdown"};  //ADD IT HERE
// -------------------------------------------------------------------
//  END OF YOUR CHANGES
// -------------------------------------------------------------------

これにより、すべての出力が Markdown テキストとしてデータベースに送信されます。

入力を HTML 形式で保存しているため、編集のために HTML を Markdown テキストに変換する場合は、次のようなものが必要になります: http://milianw.de/projects/markdownify/

したがって、ユーザーが「編集」ボタンをクリックしたとき。通常どおりクエリを実行しますが、Markdownify を介して表示テキストを実行します。

于 2011-07-05T16:06:46.470 に答える