Install and use the markdown extra plugin for wordpress

Source: Internet
Author: User
Tags html tags php source code


I used some markdown syntax and found it very good. In the past, blogs used the html language, and they still felt OK. After all, there were few html tags. Commonly used tags were code, a, li, and talbe. However, when reading the source code of the article, the several html tags still seem uncomfortable. Once opened and closed, they felt redundant. In addition, the document format does not seem clear.

But markdown won't be like that. Looking at the source code, you will feel that the entire article structure is still clear. Modify the wordpress structure and change it to the markdown syntax. Of course, you must support markdown extra.

Select and download plug-ins

The plug-in here uses the Michelin markdown classic version, which supports WordPress. Do not download it to PHP Markdown Lib, which does not support WordPress.

I found some markdown plug-ins on the internet and found a wide variety of plug-ins. I don't know how to determine them, so I just used the version of Michelin, because this is the first version I came into contact, there are preemptible ideas.

Install

This plug-in is easier to install.

Download the markdown. php file to the (site home)/wp-content/plugins/directory.
Go to the WordPress background and enable the plug-in.
Disable the visual editor. Go to the WordPress management background, select user> {select a User}> Visual editor, and choose not to use the visual editor when writing an article.
Then try to write your article using markdown ~

Compatible with syntax highlighting plug-ins

This plug-in is compatible with previous articles, but it is found that it is not compatible with SyntaxHighlighter Evolved syntax highlighting plug-in, and some redundant labels appear in the code section.

The following is the markdown. php source code:

 

Add_filter ('The _ content', 'mdwp _ markdownpost', 6 );
Add_filter ('The _ content_rss ', 'mdwp _ markdownpost', 6 );
Add_filter ('Get _ the_excerpt ', 'mdwp _ markdownpost', 6 );

The SyntaxHighlighter of markdown has different priorities. SyntaxHighlighter is 7, so I adjusted the markdown syntax to 10.

Add_filter ('The _ content', 'mdwp _ markdownpost', 10 );
Add_filter ('The _ content_rss ', 'mdwp _ markdownpost', 10 );
Add_filter ('Get _ the_excerpt ', 'mdwp _ markdownpost', 10 );
Write code in the article

To insert code in an article, you must use the SyntaxHighlighter syntax instead of the markdown syntax. After all, SyntaxHighlighter has its own syntax rules.

So the above syntax highlighting is still used as follows:


[C0de language = "php"]
Add_filter ('The _ content', 'mdwp _ markdownpost', 10 );
Add_filter ('The _ content_rss ', 'mdwp _ markdownpost', 10 );
Add_filter ('Get _ the_excerpt ', 'mdwp _ markdownpost', 10 );
[/C0de]
Forgive me for using c0de instead of code, because plug-in nesting is not good.

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.