简体   繁体   English

如何在Rails中编写用于Markdown编辑的前端界面?

[英]How to write a front-end interface for Markdown editing in Rails?

I have used Redcarpet to interpret Markdown, but use the normal Form to type Markdown. 我使用Redcarpet解释Markdown,但使用普通的Form键入Markdown。

I want a form that when I type the Markdown syntax in Form, it will highlight the text. 我想要一个表单,当我在Form中键入Markdown语法时,它将突出显示文本。

I have tried many thins but not work. 我试过很多稀薄但不起作用。 I'm not familiar with Javascript, only know a little syntax. 我不熟悉Javascript,只懂一点语法。

Could anyone give a code example ? 谁能举一个代码示例? Thanks a lot. 非常感谢。

You may be interested in something such as markituUp! Rails 您可能对诸如markituUp! Rails东西感兴趣markituUp! Rails markituUp! Rails

What you're basically looking for is a wysiwyg editor for markdown (like StackOverflow's editor). 您基本上想要的是wysiwyg编辑器(例如StackOverflow的编辑器)。 The important thing to note is this type of editor needs to be able to process inputs (selecting bold | italic | underline etc), and translating them to Rails 需要注意的重要一点是,这种类型的编辑器需要能够处理输入(选择bold | italic | underline等),并将其转换为Rails。


Javascript Java脚本

In reference to javascript, JS is just a wrapper for HTML elements 关于javascript,JS只是HTML元素的包装器

All the WYSIWYG editors out there are just a way to "decorate" your HTML text_area inputs, allowing you to assign different commands to the input. 所有所见即所得的编辑器都只是一种“修饰” HTML text_area输入的方法,允许您为输入分配不同的命令。 For example, a WYSIWYG "bold" button will just input **your_text** around your selected text 例如,所见即所得的“粗体”按钮将仅在您选择的文本周围输入**your_text**

Hope this helps? 希望这可以帮助?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM