可扩展的轻量级标记语言
轻量级标记语言提供一组固定的功能。这个功能集正在不断增长,但每次我写一篇更复杂的文章时,我都必须意识到缺少一些东西。示例包括:正确的图像标题、图表、文件包含、交叉引用等。因此,我最终围绕它创建了一个工具链,其中包含 Makefile 和棘手的 sed 命令。
我通常想在文本中插入临时标记并稍后处理它们。它们可以是单行的,也可以是更复杂的——这就是整个正则表达式方法失败的地方。这是一个想象的标记的片段。
I can generate an image from an external dot file [.myDot diag.dot The process],
and it will be included with a caption.
Or the dot source is right here [.myDotHere
foo->bar->Done;
]
我正在寻找一种可以轻松扩展以满足我的临时需求的标记工具。到目前为止我找到的选项
- Makefile,使用 sed/perl 脚本进行预处理和后处理
- 在 txt2tags 中内置正则表达式预处理
- Pandoc 将 markdown 解析为内部 AST 可以用 haskell 脚本进行转换
所以我正在寻找
- 一种轻量级的、以定制和可扩展性为设计理念的语言
- ;没有 TeX/LaTeX 请
- 不要处理我所有的具体问题,但不可扩展
- 我的输出通常只是 html,所以它不必支持很多目标
Lightweight markup languages offer a fixed set of features. This feature set is growing, but every time I write a more complex article, I have to realize something is missing. Examples include: proper image captions, table of figures, file include, cross-references, etc. So I end up creating a tool chain around it, with a Makefile and tricky sed commands.
I typically want to insert ad-hoc markers into my text and process them later. They can be one-liners, or more complex -- and this where the whole regex approach fails. Here is a snippet of an imaginary markup.
I can generate an image from an external dot file [.myDot diag.dot The process],
and it will be included with a caption.
Or the dot source is right here [.myDotHere
foo->bar->Done;
]
I'm looking for a markup tool which can be easily extended to suite my ad-hoc needs. The options I found so far
- Makefile, pre- and postprocessing with sed/perl scripts
- Built in regex pre-processing in txt2tags
- Pandoc parses markdown into an internal AST which can be transformed with haskell scripts
So what I'm looking for is
- a language designed with customization and extensibility in mind
- lightweight; no TeX/LaTeX please
- not something which handles all my specific issues, but not extensible
- My output is usually just html, so it doesn't have to support many targets
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在创建 Glyph 时考虑到了可扩展性。您可以使用 Glyph 本身或 Ruby 创建自己的宏。
Glyph 旨在使出版变得更容易,同时为作者提供所有可能的控制权,它可以管理图书元数据、目录、内部链接、片段等。
有关其所有功能的文档,请查看 Glyph book,它是使用 Glyph 本身创建的。
I created Glyph with extensibility in mind. You can create your own macros either using Glyph itself or Ruby.
Glyph aims to make publishing easier while giving all possible control to the writer, it can manage book metadata, ToC, internal links, snippets, etc. etc.
For documentation on all its features check out the Glyph book, which was created using Glyph itself.
您的“工具链”方法是一个很好的方法 - 在我看来,您不会找到一个能够满足您的特定需求的单个项目,最好遵循 *nix 哲学并使用插入您的开放工具链的最佳工具来完成工作。
如果宏包含是一个问题,不要担心通过选择标记语法来解决这个问题 - 为该特定工作找到合适的工具并在上游使用它。
在我看来,标记的选择应该基于转换工具对您所需输出的可用性。 IMO Pandoc 是迄今为止该领域开发最活跃的项目,并且非常灵活,尤其是其脚本工具。请注意,它在 GoogleGroups 中也得到了很好的支持 - 约翰可能会直接快速地回复您可能遇到的任何问题。
请注意,Pandoc 的灵活性还意味着您的主源文本不会被“锁定”,因为您可以轻松地从其扩展的 Markdown 语法转换为 reST,如果您想利用 Sphinx 或 DocBook 的功能。 (顺便说一句,还可以查看 AsciiDoc,这是最新的 Pandoc 输出 - 显然读者也在工作中)
查看 Pandoc 的“extras”wiki 页面,我对 ConTeXt 过滤器脚本特别兴奋;我不确定它是否适合您,但它包含一些宏包含功能,并且在我看来,没有什么可以给您更好的印刷控制。
Your "toolchain" approach is a good one - You won't IMO find a single project that will handle your specific needs, best to follow the *nix philosophy and use the best tool for the job that plugs into your open toolchain.
If macro inclusion is an issue, don't worry about solving that by your choice of markup syntax - find the right tool for that specific job and use it upstream.
The choice of markup should be IMO based on the availability of transformation tools to your desired output. IMO Pandoc is by far the most actively developed project in this space, and very flexible, especially with its scripting facility. Note it's also very well supported in GoogleGroups - John will likely respond directly and quickly to any issues you may have.
Note that Pandoc's flexibility also means your master source text isn't as "locked in", as you can easily convert for example from its extended markdown syntax to reST, if say you wanted to take advantage of Sphinx's or DocBook's capabilities. (BTW also check out AsciiDoc, which the latest Pandoc outputs - apparently a reader is also in the works)
Check out Pandoc's "extras" wiki page, I've been particularly excited by the ConTeXt filter script; I'm not sure if it'll be a good fit for you, but it includes some macro include capabilities, and IMO nothing will give you better typographical control.