Apache configuration supports markdown format

WBOY
Release: 2016-07-29 09:02:40
Original
2300 people have browsed it

  • Markdown

Markdown is a markup language that can be written using an ordinary text editor. Through simple markup syntax, it can make ordinary text content have a certain format.

Markdown has a series of derivative versions that are used to extend the functions of Markdown (such as tables, footnotes, embedded HTML, etc.). These functions are not yet available in the original Markdown. They can convert Markdown into more formats, such as LaTeX , Docbook. The more famous Markdown enhanced versions include Markdown Extra, MultiMarkdown, Maruku, etc. These derivative versions are either based on tools, such as Pandoc; or based on websites, such as GitHub and Wikipedia. They are basically compatible in syntax, but have changes in some syntax and rendering effects.

How can we support such an awesome markup language? Let’s introduce how to support markdown under the Apache server.

  • Parsedown

Parsedown is a PHP Markdown parser that is very fast and concise.

Plugin homepage:

http://parsedown.org/

Parsedown syntax is very simple.

$Parsedown=new Parsedown();

echo $Parsedown->text( 'Hello _Parsedown_!');# prints:

Hello Parsedown!

  • Apache configuration

Home page, Apache needs to be configured to support PHP, and then download parsedown.

Configuration added in httpd.conf

Action markdown /markdown/handler.php
      AddHandler markdown .md

Added

in handler.php require('parsedown/ Parsedown.php ');
$ File = RealPath ($ _ Server [' PATH_TRANSLED ']); ET_CONTENTS ($ File);

Others can add some style display according to their own needs. The above introduces the Apache configuration to support markdown format, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!