在 Azure 仪表板上使用 Markdown 磁贴显示自定义内容Use a markdown tile on Azure dashboards to show custom content

可以向 Azure 仪表板添加 Markdown 磁贴,以便显示自定义的静态内容。You can add a markdown tile to your Azure dashboards to display custom, static content. 例如,可以在 Markdown 磁贴上显示基本的说明、图像或一组超链接。For example, you can show basic instructions, an image, or a set of hyperlinks on a markdown tile.

向仪表板添加 Markdown 磁贴Add a markdown tile to your dashboard

  1. 在 Azure 门户边栏中选择“仪表板”。 Select Dashboard from the Azure portal sidebar.

    屏幕截图,显示门户边栏

  2. 如果已创建任何自定义仪表板,请在仪表板视图中通过下拉列表选择会显示自定义 Markdown 磁贴的仪表板。If you've created any custom dashboards, in the dashboard view, use the drop-down to select the dashboard where the custom markdown tile should appear. 选择用于打开磁贴库的编辑图标。Select the edit icon to open the Tile Gallery.

    屏幕截图,显示仪表板编辑视图

  3. 在“磁贴库”中找到名为 Markdown 的磁贴,然后选择“添加”。 In the Tile Gallery, locate the tile called Markdown and select Add. 此时会将磁贴添加到仪表板,而“编辑 Markdown”窗格也会打开。 The tile is added to the dashboard and the Edit Markdown pane opens.

  4. 输入“标题”和“副标题”的值,这些值会在你转到另一字段后显示在磁贴上。 Enter values for Title and Subtitle, which display on the tile after you move to another field.

    屏幕截图,显示输入标题和副标题后的结果

  5. 选择用于添加 Markdown 内容的选项之一:“内联编辑”或“使用 URL 插入内容”。 Select one of the options for including markdown content: Inline editing or Insert content using URL.

    • 如果要直接输入 Markdown,请选择“内联编辑”。 Select Inline editing if you want to enter markdown directly.

      屏幕截图,显示输入内联内容

    • 如果要使用以联机方式托管的现有 Markdown 内容,请选择“使用 URL 插入内容” 。Select Insert content using URL if you want to use existing markdown content that's hosted online.

      屏幕截图,显示输入 URL

      备注

      为了增加安全性,可以创建一个 Markdown 文件,将其存储在启用了加密的 Azure 存储帐户 Blob 中,然后使用 URL 选项指向该文件。For added security, you can create a markdown file and store it in an Azure storage account blob where encryption is enabled, then point to the file using the URL option. 通过存储帐户的加密选项来加密 Markdown 内容。The markdown content is encrypted through the storage account's encryption options. 只有有权访问文件的用户才能查看仪表板上的 Markdown 内容。Only users with permissions to the file can see the markdown content on the dashboard.

  6. 选择“完成”,关闭“编辑 Markdown”窗格。 Select Done to dismiss the Edit Markdown pane. 内容会显示在 Markdown 磁贴上,该磁贴可以通过在右下角拖动图柄来重设大小。Your content appears on the Markdown tile, which you can resize by dragging the handle in the lower right-hand corner.

    屏幕截图,显示自定义 Markdown 磁贴

Markdown 内容功能和限制Markdown content capabilities and limitations

可以在 Markdown 磁贴上使用纯文本、Markdown 语法和 HTML 内容的任意组合。You can use any combination of plain text, Markdown syntax, and HTML content on the markdown tile. Azure 门户使用名为 marked 的开源库将内容转换为在磁贴上显示的 HTML。The Azure portal uses an open-source library called marked to transform your content into HTML that is shown on the tile. 通过 marked 生成的 HTML 在呈现之前先由门户进行预处理。The HTML produced by marked is pre-processed by the portal before it's rendered. 此步骤有助于确保自定义不会影响门户的安全性或布局。This step helps make sure that your customization won't affect the security or layout of the portal. 在该预处理期间,HTML 中任何带有潜在威胁的内容都会被删除。During that pre-processing, any part of the HTML that poses a potential threat is removed. 门户不允许以下类型的内容:The following types of content aren't allowed by the portal:

  • JavaScript - <script> 标记以及内联的 JavaScript 评估会被删除。JavaScript – <script> tags and inline JavaScript evaluations will be removed.
  • iframe - <iframe> 标记会被删除。iframes - <iframe> tags will be removed.
  • 样式 - <style> 标记会被删除。Style - <style> tags will be removed. HTML 元素上的内联样式属性没有获得正式支持。Inline style attributes on HTML elements aren't officially supported. 你可能会发现,某些内联样式属性可以使用,但如果它们干扰门户的布局,系统可能会随时停用它们。You may find that some inline style elements work for you, but if they interfere with the layout of the portal, they could stop working at any time. Markdown 磁贴适用于基本的静态内容,该内容使用门户的默认样式。The Markdown tile is intended for basic, static content that uses the default styles of the portal.

后续步骤Next steps