本文介绍了Markdown中的语义标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一个简单的文本编辑器和Markdown做课堂笔记.有没有一种方法可以标记文本元素以使其可机读?

I'd like to take class notes using a simple text editor and Markdown. Is there a way to tag elements of the text to make them machine readable?

例如,我想将某些单词和短语标记为定义".然后,我可以运行某种脚本来显示单词及其相应的定义.

For example, I'd like to tag certain words and phrases as "definitions". Then later, I could run some sort of script to display words and their corresponding definitions.

推荐答案

对于定义(没有标记),没有特定的markdown语法.您可能可以使用blockquote语法:

There is no specific markdown syntax for definitions (let alone tag). You could probably use the blockquote syntax :

> blablabla

...或者您可以简单地强调要定义的术语:

...or you could simply emphasize the term you are about to define :

**word** : a word is a blablabla


但是,markdown内的html代码在语法上是正确的,因此您可以将标签与类属性一起使用:


However, html code inside markdown is syntactically correct so you could use tags with class attributes like this :

<div class="definition important">blablabla</div>

在这种情况下,有HTML5标签覆盖定义:

In that particular case, there are HTML5 tags covering definitions :

<dl>
  <dt>Coffee</dt>
    <dd>Black hot drink</dd>
  <dt>Milk</dt>
    <dd>White cold drink</dd>
</dl>

这篇关于Markdown中的语义标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 16:35