2011-01-28 22 views

回答

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標記轉換爲markdown標記爲了編輯內容 – 2011-01-28 20:04:04

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運行顯示文本。