The original markdown text is stored in the data, and now you want to read the browsing page? How to render? Convert it to html format and then put it on the terminal page? Or directly put the markdown text on the front-end page, and then use the js rendering function to render it into formatted text. Either way, the user reads the original markdown text in the data and then reads the browser page? How to render?
Convert it to html format and then put it on the terminal page?
Or directly put the markdown text on the front-end page, and then use the js rendering function to render it into formatted text.
Either way, the user must see formatted text, but the source code of the webpage should be all html in the first way, and the content of the Subject displayed in the source code in the second method should be markdown text, not html text
Which method is better? Only read from the database to the front-end display (I use bootstrap-markdown)
Reply content:
The original markdown text is stored in the data, and now you want to read the browsing page? How to render?
Convert it to html format and then put it on the terminal page?
Or directly put the markdown text on the front-end page, and then use the js rendering function to render it into formatted text.
Either way, the user must see formatted text, but the source code of the webpage should be all html in the first way, and the content of the Subject displayed in the source code in the second method should be markdown text, not html text
Which method is better? Only read from the database to the front-end display (I use bootstrap-markdown)
The rendering process is handed over to the front-end for completion ......
InTypecho
Is usedPHP
Rendered and displayed to the user.
In fact, js rendering or background language rendering are optional.
It depends mainly on the specific problems and functions.
For a blog, using these two methods does not matter much.
You have misunderstood the subject. The content that the browser can present or render must comply with the webpage specifications: html and css
The content of markdown cannot be understood by the browser. You need to use the md parsing library to convert the content of md into the tags and styles required by the browser.
For example, "# Title" in markdown is "", and the display effect is as follows:
Title
What the parser does is to talk about your md text "# Title" and convert it into a tag that the browser can understand ""
So what you need is a Markdown Parsing Library, for example: parsedown
Second, how do you modify the first one?
Only the markdown format is retained. You can parse the output or use js to parse the output.
Search for questions.
A certain degree and Google can produce dozens of pages of results.
You can also search in the Community first. This is also a bad question.
Refer to another question on this site:
Http://segmentfault.com/q/1010000004113131