Skip to content

Markdown (OrchardCore.Markdown)

Markdown(OrchardCore.Markdown)

Theming

主题化

Shapes

形状

The following shapes are rendered when the BodyPMarkdownBodyPartart is attached to a content type

BodyPMarkdownBodyPartart 附加到内容类型时,将呈现以下形状

| Name | Display Type | Default Location | Model Type |

|名称|显示类型|默认位置|型号类型|

| ------| ------------ |----------------- | ---------- |

| ------ | ------------ | ----------------- | ---------- |

| MarkdownBodyPart | Detail | Content:5 | MarkdownBodyPartViewModel |

| MarkdownBodyPart | 细节| 内容:5 | MarkdownBodyPartViewModel |

| MarkdownBodyPart | Summary | Content:10 | MarkdownBodyPartViewModel |

| MarkdownBodyPart | 摘要| 内容:10 | MarkdownBodyPartViewModel |

BodyPartViewModel

BodyPartViewModel

The following properties are available on the MarkdownBodyPartViewModel class.

MarkdownBodyPartViewModel类提供以下属性。

| Property | Type | Description |

|财产|输入|说明|

| --------- | ---- |------------ |

| --------- | ---- | ------------ |

| Markdown | string | The Markdown value after all tokens have been processed |

| Markdown | string |处理完所有令牌后的Markdown值

| Html | string | The HTML content resulting from the Markdown source |

| Html | string | Markdown源代码生成的HTML内容

| ContentItem | ContentItem | The content item of the part |

| ContentItem | ContentItem |部分的内容项目

| MarkdownBodyPart | MarkdownBodyPart | The MarkdownBodyPart instance|

| MarkdownBodyPart | MarkdownBodyPart | MarkdownBodyPart实例|

| TypePartSettings | MarkdownBodyPartSettings | The settings of the part |

| TypePartSettings | MarkdownBodyPartSettings |部分的设置|

MarkdownBodyPart

MarkdownBodyPart

The following properties are available on MarkdownBodyPart

MarkdownBodyPart提供以下属性

| Name | Type | Description |

|名称|输入|说明|

| -----| ---- |------------ |

| ----- | ---- | ------------ |

| Markdown | The Markdown content. It can contain Liquid tags so using it directly might result in unexpected results. Prefer rendering the MarkdownBodyPart shape instead |

| Markdown | Markdown内容。它可以包含Liquid标签,因此直接使用它可能会导致意外结果。更喜欢渲染MarkdownBodyPart形状

| Content | The raw content of the part |

| 内容|部分的原始内容|

| ContentItem | The content item containing this part |

| ContentItem |包含此部分的内容项目

MarkdownField

MarkdownField

This shape is rendered when a MarkdownField is attached to a content part.

当“MarkdownField”附加到内容部分时,将呈现此形状。

The shape base class is of type MarkdownFieldViewModel.

形状基类的类型为“MarkdownFieldViewModel”。

The following properties are available on the MarkdownFieldViewModel class.

MarkdownFieldViewModel类提供以下属性。

| Property | Type | Description |

|财产|输入|说明|

| --------- | ---- |------------ |

| --------- | ---- | ------------ |

| Markdown | string | The Markdown value once all tokens have been processed |

| Markdown | string |处理完所有令牌后的Markdown值|

| Html | string | The HTML content resulting from the Markdown source |

| Html | string | Markdown源代码生成的HTML内容

| Field | MarkdownField | The MarkdownField instance|

| Field | MarkdownField | MarkdownField实例|

| Part | ContentPart | The part this field attached to |

| Part | ContentPart |此字段附加到|的部分

| PartFieldDefinition | ContentPartFieldDefinition | The part field definition |

| PartFieldDefinition | ContentPartFieldDefinition |零件字段定义|

Editors

编者

The Markdown Part editor can be different for each content type. In the Markdown Part settings of a

每个内容类型的__Markdown Part__编辑器可以不同。在a的__Markdown Part__设置中

content type, just select the one that needs to be used.

内容类型,只需选择需要使用的内容。

There are two predefined editor names:

有两个预定义的编辑器名称:

  • Default is the editor that is used by default

  • Default是默认使用的编辑器

  • Wysiwyg is the editor that provides a WYSIWYG experience

  • Wysiwyg是提供WYSIWYG体验的编辑器

Custom Editors

自定义编辑器

Customizing the editor can mean to replace the predefined one with different experiences, or to provide

自定义编辑器可能意味着用不同的体验替换预定义的编辑器,或者提供

new options for the user to choose from.

用户可供选择的新选项。

To create a new custom editor, it is required to provide two shape templates, one to provide

要创建新的自定义编辑器,需要提供两个形状模板,一个用于提供

the name of the editor (optional if you want to override an existing one), and a shape to

编辑器的名称(如果要覆盖现有编辑器,则为可选项)和形状

render the actual HTML for the editor.

呈现编辑器的实际HTML。

Declaration

宣言

To declare a new editor, create a shape named Markdown_Option__{Name} where {Name} is a value

要声明一个新的编辑器,创建一个名为Markdown_Option __ {Name}的形状,其中{Name}是一个值

of your choosing. This will be represented by a file named Markdown-{Name}.Option.cshtml.

你选择的。这将由名为Markdown- {Name} .Option.cshtml的文件表示。

Sample content:

示例内容:


@{

 <font color=#0099ff size=4 face="黑体">@ {</font> 


    string currentEditor = Model.Editor;

}

 <font color=#0099ff size=4 face="黑体">}</font> 


<option value="Wysiwyg" selected="@(currentEditor == "Wysiwyg")">@T["Wysiwyg editor"]</option>

 <font color=#0099ff size=4 face="黑体"><option value =“Wysiwyg”selected =“@(currentEditor ==”Wysiwyg“)”> @ T [“Wysiwyg编辑”] </ option></font> 


HTML Editor

HTML编辑器

To define what HTML to render when the editor is selected from the settings, a shape named

要定义从设置中选择编辑器时要呈现的HTML,请使用名为的形状

Markdown_Editor__{Name} corresponding to a file Markdown-{Name}.Editor.cshtml can be created.

Sample content:

示例内容:


@using OrchardCore.Markdown.ViewModels;

 <font color=#0099ff size=4 face="黑体">@using OrchardCore.Markdown.ViewModels;</font> 


@model MarkdownBodyPartViewModel

 <font color=#0099ff size=4 face="黑体">@model MarkdownBodyPartViewModel</font> 





 <font color=#0099ff size=4 face="黑体"></font> 


<fieldset class="form-group">

 <font color=#0099ff size=4 face="黑体"><fieldset class =“form-group”></font> 


    <label asp-for="Markdown">@T["Markdown"]</label>

    <textarea asp-for="Markdown" rows="5" class="form-control"></textarea>

    <span class="hint">@T["The markdown of the content item."]</span>

</fieldset>

 <font color=#0099ff size=4 face="黑体"></字段集></font> 


Overriding the predefined editors

覆盖预定义的编辑器

You can override the HTML editor for the Default editor by creating a shape file named

您可以通过创建名为的形状文件来覆盖“Default”编辑器的HTML编辑器

Markdown.Editor.cshtml. The Wysiwyg editor is defined by using the file named

Markdown-Wysiwyg.Editor.cshtml.

CREDITS

学分

Markdig

Markdig

https://github.com/lunet-io/markdig

https://github.com/lunet-io/markdig

Copyright (c) 2016, Alexandre Mutel

版权所有(c)2016,Alexandre Mutel

BSD-2

BSD-2

SimpleMDE

SimpleMDE

https://github.com/NextStepWebs/simplemde-markdown-editor

https://github.com/NextStepWebs/simplemde-markdown-editor

Copyright (c) 2015 Next Step Webs, Inc.

版权所有(c)2015 Next Step Webs,Inc。

MIT

MIT