我们可以在内容丰富的单行文本字段中加下划线吗?

Can we put underline in single line text field of contentful?

I added one field which is of type text as single line. Now I need to make some of the text as underline.for example:-

He is a good employee.

I want underline in employee text. How can I add that in contentful?

当您使用 Markdown 编辑器时,问题不在于 Contentful,而是 the markdown specs 本身。它们不提供 "underline" 功能。

关于下划线的问题是a common question。 Markdown 的想法是只关心内容而不是真正的表示(例如 "bold" 转换为 html strong 元素,它在语法上代表重要部分)。

带下划线的 IMO 文本也很容易与链接混淆。

如果你必须完成这项工作,你可以引入内联 HTML(缺点是你会失去跨平台兼容性,因为不是每个系统都能处理 HTML)或例如,您处理使用 Contentful 的应用程序中的下划线功能 CSS。

例如假设您想在 application/website 中突出显示某些内容,我可以看出 "bold"/"strong" 的含义可能适合您。

Markdown 的总体经验法则是考虑文档结构和内容,而不是它的外观。 "These are important words in this paragraph" () 对比 "These are words that should be underlined" ().

在 Contentful 中将 Markdown 下的文本写为:-

He is a good <u>employee</u>

现在在我们的 reactjs 应用程序中我们可以写:-

dangerouslySetInnerHTML={{
                __html: employee.childMarkdownRemark.html,
              }}

因此,如果我们在 dangerouslySetInnerHTML 下呈现 childMardownRemark.html 中的输出,那么员工将在我们的 UI.

中作为 下划线 出现