Apache configuration supports markdown format

Source: Internet
Author: User
: This article describes how to configure Apache to support the markdown format. For more information about PHP tutorials, see.
  • Markdown

Markdown is a markup language that can be written in a common text editor. through simple markup syntax, Markdown can make the common text content have a certain format.

Markdown has a series of derivative versions used to extend Markdown functions (such as tables, memos, embedded HTML, and so on). These functions are not available in the original Markdown, and they allow Markdown to be converted into more formats, for example, LaTeX and Docbook. The Markdown enhanced edition is famous for its Markdown Extra, MultiMarkdown, and Maruku. These derivative versions are either based on tools, such as Pandoc; or based on websites such as GitHub and Wikipedia, which are syntactically compatible, but with some modifications to syntax and rendering effects.

How can we support this awesome markup language? next we will introduce how to support markdown on the Apache server.

  • Parsedown

Parsedown is a PHP Markdown parser, which is fast and concise.

Plug-In homepage:

Http://parsedown.org/

Parsedown syntax is very simple.

$ Parsedown = new Parsedown ();

Echo $ Parsedown-> text ('Hello _ Parsedown _! '); # Prints:

HelloParsedown!

  • Apache configuration

On the home page, Apache needs to be configured to support PHP and then download parsedown.

Add configuration in httpd. conf

Action markdown/handler. php
AddHandler markdown. md

Add in handler. php

Require ('parsedown/parsedown. php ');
$ File = realpath ($ _ SERVER ['path _ TRANSLATED ']);
$ Parsedown = new Parsedown ();
Echo $ Parsedown-> text (file_get_contents ($ file ));

Others can add some style display as needed.

The above introduces the support for markdown format for Apache configuration, including content, and hope to be helpful to friends who are interested in PHP tutorials.

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.