When the markdown editor replaces the common visual editor, the front-end shows how to solve the problem

Source: Internet
Author: User
For example, I have two ideas: first, the disadvantage of using js for front-end processing is that it is unfriendly to search engines. I personally feel that the search engine may not be highly compatible with markdown text. Second, convert markdown text to html during output so that code consistency can be achieved. for example, I have two ideas:
First, the disadvantage of using js for front-end processing is that it is unfriendly to search engines. I personally feel that the search engine may not be highly compatible with markdown text.
Second, the markdown text is converted to html during output, so that code consistency can be achieved. the code output from the backend to the front-end is html, however, this kind of bug can be greatly changed by the framework itself to support markdown conversion. However, if plug-ins are developed for others or the development framework is ready, it is difficult to convert a large area in a view. how can this problem be solved.

The first one has been implemented in the markdown editor extension. recently I have been thinking about how to control content output in a simple and effective manner. I have encountered the following problems:
1. how to determine whether the content of a string is markdown text content
2. how to bulk convert markdown content without changing the view template

In view of the above, I hope to share with you the markdown presentation solution.
Ps:
The editor uses editmd as the markdown input and output.

Extended source code can be obtained through http://git.oschina.net/hainuo...

Reply content:

For example, I have two ideas:
First, the disadvantage of using js for front-end processing is that it is unfriendly to search engines. I personally feel that the search engine may not be highly compatible with markdown text.
Second, the markdown text is converted to html during output, so that code consistency can be achieved. the code output from the backend to the front-end is html, however, this kind of bug can be greatly changed by the framework itself to support markdown conversion. However, if plug-ins are developed for others or the development framework is ready, it is difficult to convert a large area in a view. how can this problem be solved.

The first one has been implemented in the markdown editor extension. recently I have been thinking about how to control content output in a simple and effective manner. I have encountered the following problems:
1. how to determine whether the content of a string is markdown text content
2. how to bulk convert markdown content without changing the view template

In view of the above, I hope to share with you the markdown presentation solution.
Ps:
The editor uses editmd as the markdown input and output.

Extended source code can be obtained through http://git.oschina.net/hainuo...

Individuals prefer the first solution.
First, this is more conducive to frontend and backend separation. For example, when the front-end is compatible with multiple display styles, the back-end may not change the code.
Secondly, for the search engine indexing problem you mentioned, I think even the Markdown text is quite readable. Furthermore, as more and more websites adopt asynchronous loading and single-page mode, search engines are gradually improving their crawling mechanism. In addition, key information can be directly specified through meta.

I don't need to judge whether the string is markdown. If it is not markdown, even if markdown is used for parsing, the output is the most basic text.
Without changing the View, the content is converted. In fact, I step on the pitfalls mentioned above, that is, back-end conversion is difficult to avoid the absence of front-end and back-end separation, conversion involves the coexistence of the conversion program and view module code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.