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

justinvh/Markdown-LaTeX: This Markdown extension adds inline LaTeX support witho ...

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

开源软件名称(OpenSource Name):

justinvh/Markdown-LaTeX

开源软件地址(OpenSource Url):

https://github.com/justinvh/Markdown-LaTeX

开源编程语言(OpenSource Language):

Python 100.0%

开源软件介绍(OpenSource Introduction):

Markdown-LaTeX

This Markdown extension adds support for inline LaTeX expressions without the need for external images. The available modes are %TEXT%, $MATH$, and %%PREAMBLE%%.

Modes

Markdown-LaTeX can technically allow for any sort of LaTeX expression, but there are three main modes that make writing everything much easier.

%TEXT% mode

The most basic of the modes is %TEXT% mode. Any expression within %TEXT% will be parsed in a basic LaTeX text-mode, e.g. plain. For example, %``Justin Bruce Van Horne''%.

$MATH$ mode

Math mode is our second basic functionality of Markdown-LaTeX. It automatically puts LaTeX into math mode and allows for inline and multiline expressions. Let's say that we wanted to write Euler's formula: We would then write $e^{\imath x} = \cos{x} + \imath\sin{x}$.

%%PREAMBLE%% mode

Preamble mode is the only "complex" mode. It allows you to add to the preamble of the LaTeX template. So, if there are specific packages or commands you want for the HTML page, then this is where to do it. This is a global modifier and will affect the entire document. I haven't come up with an intuitive design for a per-expression basis.

Dependencies

Markdown-LaTeX depends on:

Installation

You can either copy it into the extensions sub-directory in your markdown folder (ex: /usr/lib/python2.7/site-packages/markdown/extensions/latex.py) or use it locally with the mdx_ prefix. See Markdown Extensions for more details.

Usage

markdown -x latex somefile.markdown > somefile.html

Configuration

This plugin uses dvipng in order to produce the output images. The arguments passed to dvipng are configurable, see tests/markdown-latex.cfg for an example. In particular, you may want to adapt the argument passed to the -D option in order to change output resolution resp. font size.

You may also change the delimiters used for text, math and preamble mode within the configuration file, see tests2/markdown-latex.cfg. When running this plugin on existing text you need to escape all occurrences of % and $. Changing delimiters may reduce this effort.


How does it work?

The LaTeX extension will search for either $text$ or %text% expressions. For each expression, it generates a tex file that is parsed by latex and then run through dvipng. The data is encoded via base64 and then inlined. A cache file (latex.cache) is used to store all expressions and their base64 counterparts. This is to prevent latex from being run each time.


Suggestions/Improvements:




鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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