• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

cebe/markdown-latex: A markdown parser for converting markdown to LaTeX written ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

cebe/markdown-latex

开源软件地址(OpenSource Url):

https://github.com/cebe/markdown-latex

开源编程语言(OpenSource Language):

PHP 77.9%

开源软件介绍(OpenSource Introduction):

markdown-latex

Latest Stable Version Total Downloads Build Status Code Coverage Scrutinizer Quality Score

A markdown parser for converting markdown to LaTeX written in PHP.

Implementation based on cebe/markdown.

Installation

PHP 5.4 or higher is required to use it.

Installation is recommended to be done via composer by adding the following to the require section in your composer.json:

"cebe/markdown-latex": "*"

Run composer update afterwards.

Usage

In your PHP project

To use the parser as is, you just create an instance of a provided flavor class and call the parse()- or parseParagraph()-method:

// default markdown and parse full text
$parser = new \cebe\markdown\latex\Markdown();
$parser->parse($markdown);

// use github
$parser = new \cebe\markdown\latex\GithubMarkdown();
$parser->parse($markdown);

// parse only inline elements (useful for one-line descriptions)
$parser = new \cebe\markdown\latex\GithubMarkdown();
$parser->parseParagraph($markdown);

The command line script

You can use it to render this readme:

bin/markdown-latex README.md > output.tex

Using github flavored markdown:

bin/markdown-latex --flavor=gfm README.md > output.tex

or convert the original markdown description to html using the unix pipe:

curl http://daringfireball.net/projects/markdown/syntax.text | bin/markdown-latex > output.tex

To create a latex document you have to include the generated latex source in a latex document main.tex:

\documentclass[a4paper, 12pt]{article}

% english and utf8
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}

% url support
\usepackage{url}

% make links clickable
\usepackage{hyperref}

% code listings
\usepackage{listings}

% include images
\usepackage{graphicx}

% better tables using tabularx
\usepackage{tabularx}

% support github markdown strikethrough
% http://tex.stackexchange.com/questions/23711/strikethrough-text
\usepackage{ulem}

\begin{document}

	\include{output.tex}

\end{document}

make a PDF with pdflatex main.tex.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap