向标记文本添加元数据

时间:2015-06-30 04:22:33

标签: html metadata markdown

我正在研究创建注释的软件,并希望我的主要数据结构基于降价。

我正在考虑使用现有的降价编辑器,但是将其黑客攻击以便某些标记(即exampleData)不会显示为呈现的HTML;以上内容将在HTML预览中输出 var exampleData = [ {id: 1, title:'something'}, {id: 2, title:'something'}, {id: 3, title:'something'} ]; module('myModule', function($provide) { $provide.value('exampleData', exampleData); }); beforeEach(inject(function($state) { ctrl = $controller('ExampleCtrl'); })); ,并链接到ID为[annotation-id-001]Sample text.[/annotation-id-001]的单独注释。

我的问题是,这是在降价文档中表示此类元数据的最有效方式吗?此外,如果用户想要合法地使用Sample text.之类的文本作为文档内部的文本,我认为我必须使该字符串语法非法,正确吗?

1 个答案:

答案 0 :(得分:2)

I don't know what Markdown parser you use but you can abord your problem with different points of view:

  • first you can "hack" an existing parser to exclude your annotation tags from "classic" parsing and include them only in a certain mode
  • you can also use the internal "meta-data" information proposed by certain parsers (like MultiMarkdown or MarkdownExtended) and only write your annotations like meta-data with a reference to their final place in content
  • or, as mentionned by mb21, you can use simple links notation like [Sample text.](#annotation-id-001) or use footnotes like [Sample text.](^annotation-id-001) and put your annotations as footnotes.