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

JuliaAttic/Markdown.jl: Markdown parsing for Julia

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

开源软件名称:

JuliaAttic/Markdown.jl

开源软件地址:

https://github.com/JuliaAttic/Markdown.jl

开源编程语言:

Julia 100.0%

开源软件介绍:

Markdown

Markdown.parse_file("file.md")
readme("Markdown") # or any other installed package

Markdown.jl is a flexible and efficient markdown parser for Julia. It supports a preliminary implementation of CommonMark as well as GitHub, IPython and Julia flavoured markdown.

Note that Markdown.jl lives in Base Julia form 0.4 onwards. PRs and changes should be made over there.

## Examples

You can construct Markdown by parsing it with Markdown.parse("...") or inline with the md"..." string macro. The created object will display itself nicely in HTML environments and the terminal.

You can also grab a package's readme with e.g. readme("Markdown").

Say we have a docstring that looks like so:

md"""
  # Fast Fourier Transform

      Base.fft(A[, dims])

  Performs a multidimensional FFT of the array `A`.  The optional
  `dims` argument specifies an iterable subset of dimensions (e.g.
  an integer, range, tuple, or array) to transform along.  Most
  efficient if the size of `A` along the transformed dimensions is
  a product of small primes; see `nextprod()`.  See also
  `plan_fft()` for even greater efficiency.

  A multidimensional FFT simply performs this operation along each
  transformed dimension of `A`.

  $(let x = [1:100]
      plot(x = 1:100, y = real(fft(sin(x) + sin(2x))), Geom.line)
    end)
  """

In the terminal this will render like so:

terminal

In Juno (pending CSS updates), like so:

juno

What's that you say? Why yes, I believe it is an interpolated Gadfly plot. Yes, it is indeed interactive. No, this probably won't actually be useful until we standardise on a plotting package in Base, but it's still pretty cool, right?

Incidentally, the interpolation also potentially solves the problem of growing a non-standard Markdown implementation, since anything we need can actually be interpolated as an object with appropriate writemime methods defined. I do plan to have Markdown syntax for tables, equations etc. anyway but until then you can always just interp. an Equation object of some sort.

So now all we need is syntax highlighting and Mathematica-style ASCII equation rendering in the terminal and we're all set.




鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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