2011-01-28 6 views
0

私はWMDエディタを使用しています。追加しますwmd_options = {"output": "Markdown"};WMDエディタの追加方法 - wmd_options = {"output": "Markdown"};

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

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

この行を追加するにはどうすればよいですか。

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

私はこれを使用するのを助けてください。

おかげ

答えて

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

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

+0

私はこれを試しましたが、残念ながら動作しません。私はこのスレッドの解決策を参照していますhttp://stackoverflow.com/questions/122108/how-do-you-store-the-markdown-using-wmd-in-asp-net、ここで、HTMLタグをマークダウンタグに変換したいコンテンツを編集するには –

+0

HTMLをMarkdownに変換しますか? WMDエディタはそのようには機能しません。 MarkdownをHTMLに変換するだけです。あなたが言及したオプションは、あなたがフォームを送信するときにどのフォーマットがサーバに送り返されるかを選択することを可能にします。おそらく、フォームの内容をMarkdownとしてデータベースに保存して、再度編集することができます。このhttp://michelf.com/projects/php-markdown/を使用して、MarkdownをHTMLに変換してください。 – Neil

+0

これはいいですね! – jurgemaister

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 
// ------------------------------------------------------------------- 

これは、マークダウンテキストとしてデータベースにあなたの出力のすべてを送信します。

あなたがHTMLフォームにご入力を格納しているため、編集のために値下げテキストにHTMLを変換したい場合は、このようなものが必要になります。ユーザーが自分の「編集」をクリックしたときに http://milianw.de/projects/markdownify/

をボタン。通常どおりにクエリを実行しますが、Markdownifyで表示テキストを実行します。

関連する問題