Giter VIP home page Giter VIP logo

markdown-latex's 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.

markdown-latex's People

Contributors

cebe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

markdown-latex's Issues

Please update Composer / Packagist package

I've recently started using this software, and it's awesome, thank you very much for publishing it.

The v1.0.0 package accessible via Composer was created a few days before you added an important commit to this repo - to allow \escaping and use of LaTeX commands. Is there any chance you could push a new version to Packagist, please?

Many thanks.

% sign in markdown not properly escaped

When there is a % sign in the source markdown, it is left unescaped, causing the rest of the line to be treated as a comment by LaTeX. It should be instead replaced by \%.

Composer version not up to date

I was having issues with tables when I found out, that the version I got with composer isn't the most recent one...

Could you please fix this?

T. Y.

[question] It is possible to disable some parsers

I am coding a write section, and I dont want users can uses some markdown features, I dont want reinvet the wheel and for this I am trying with markdown.

I hope can uses only bolds, italics, lists, headers.

And disable codes, quoutes, links and images.

Its posible with this library? Or I need some different

Tag for stable version possible?

I'd like to use yiisoft/yii2-apidoc in a stability stable composer project, but it requires this package cebe/markdown-latex, which has no stable tag.

A 0.0.1 would be sufficient ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.