简体   繁体   中英

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.

I want a form that when I type the Markdown syntax in Form, it will highlight the text.

I have tried many thins but not work. I'm not familiar with Javascript, only know a little syntax.

Could anyone give a code example ? Thanks a lot.

You may be interested in something such as markituUp! Rails markituUp! Rails

What you're basically looking for is a wysiwyg editor for markdown (like StackOverflow's editor). 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


Javascript

In reference to javascript, JS is just a wrapper for HTML elements

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. For example, a WYSIWYG "bold" button will just input **your_text** around your selected text

Hope this helps?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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