我正在使用WMD编辑器,我想添加wmd_options = {"output": "Markdown"};
我在标记之前有以下行。
<script type="text/javascript" src="../wmd/wmd.js"></script>
我想了解如何添加此行。
wmd_options = {"output": "Markdown"};
我不是很擅长使用javascript,请帮我使用。
由于
答案 0 :(得分:4)
<script type="text/javascript">
wmd_options = {"output": "Markdown"};
</script>
<script type="text/javascript" src="../wmd/wmd.js"></script>
Javascript按照页面中包含的顺序执行代码(从上到下)。因此,您需要在执行wmd.js文件中的代码之前先设置wmd_options。
答案 1 :(得分: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转换为Markdown文本进行编辑,因为您要以HTML格式存储输入,那么您将需要以下内容: http://milianw.de/projects/markdownify/
因此,当您的用户点击其“修改”按钮时。您可以像往常一样运行查询,但是通过Markdownify运行显示文本。