How does the markdown text render to the page?

Source: Internet
Author: User
The data is in the original eco-markdown text, and now you want to read to the browse page? How to render?

    1. First into HTML format, then to the terminal page?

    2. or directly put markdown text on the front page, and then use the JS rendering function to render the formatted text.

Either way, the user is sure to see the formatted text, but the first way to see the page source code should be all HTML, and the second method to see the source code to see the main content should be markdown text, rather than HTML text

Which method is good? Only consider reading from the database to the front-end display this process (I use Bootstrap-markdown)

Reply content:

The data is in the original eco-markdown text, and now you want to read to the browse page? How to render?

    1. First into HTML format, then to the terminal page?

    2. or directly put markdown text on the front page, and then use the JS rendering function to render the formatted text.

Either way, the user is sure to see the formatted text, but the first way to see the page source code should be all HTML, and the second method to see the source code to see the main content should be markdown text, rather than HTML text

Which method is good? Only consider reading from the database to the front-end display this process (I use Bootstrap-markdown)

The rendering process is done to the front end ...

In, Typecho it is PHP displayed to the user after rendering.

In fact, the use of JS rendering or background language rendering, are optional.

The most important thing is that it depends on the specific problem and function.

As simple as a blog, the use of these two are not much of a relationship.

You understand the problem. Browsers can be rendered, or can be rendered, must be in line with the content of the specification: HTML,CSS

Markdown content, the browser can not understand, you need to use MD's analytic library, the content of the MD, the browser needs to change the label and style.
For example, the "# # Title" in Markdown is "

", the display effect is this:

Title

The parsing library is about your MD text "# Title", which translates into a browser-understandable label "

"
So what you need is a markdown analytic library, such as: Parsedown.

The second, with the first how do you modify?

Only preserve the markdown format, you can parse the output or use JS parsing can

Search before asking questions.

A certain degree and Google can come out dozens of pages of results.

Second, you can search the community first. This question is about to be asked Rotten.

Refer to another question on this site:

http://segmentfault.com/q/1010000004113131

  • 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.