docfx icon indicating copy to clipboard operation
docfx copied to clipboard

[Feature Request] Support alert styles that compatible to `learn.microsoft.com`

Open filzrev opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe.

Currently docfx supports Alerts by using Bootstrap's alert styles

Recently GFM(GitHub Flavored Markdown) supports same alert syntax.
But its styles are similar to the styles of `learn.microsoft.com'. And supports more background color variations.

Describe the solution you'd like Add support for GitHub or learn.microsoft.com compatible alert styles.

Additional context These features might be implemented by markdig as custom extensions. (https://github.com/xoofx/markdig/issues/774)

filzrev avatar Feb 24 '24 06:02 filzrev

Today NOTE/TIP and IMPORTANT/CAUTION uses the same color and icon, we can make TIP green and give it a lightbulb icon , make important purple and give it a exclamation icon.

yufeih avatar Feb 26 '24 13:02 yufeih

Markdig 0.36.0 supports new Alerts markdig extension.

But it seems some features are missing that are supported in docfx.

  • It can't add/modify SVG icons styles. Because images are embedded in output HTML.
  • Custom Alerts are not supported.
  • Label customization/localization features are not supported.

So it can't support new styles with simply extension replacement. It need to extend existing QuoteSectionNote docfx markdig extensions.

It supports both existing alert styles and GitHub/learn.microsoft.com styles. and it can switch style by configurations.

"markdownEngineProperties" {
  "alertStyle": "docfx" // `docfx`(Default) or `GitHub
}

filzrev avatar Mar 14 '24 09:03 filzrev

Markdig 0.36.0 supports new Alerts markdig extension.

But it seems some features are missing that are supported in docfx.

  • It can't add/modify SVG icons styles. Because images are embedded in output HTML.
  • Custom Alerts are not supported.
  • Label customization/localization features are not supported.

So it can't support new styles with simply extension replacement. It need to extend existing QuoteSectionNote docfx markdig extensions.

It supports both existing alert styles and GitHub/learn.microsoft.com styles. and it can switch style by configurations.

"markdownEngineProperties" {
  "alertStyle": "docfx" // `docfx`(Default) or `GitHub
}

@filzrev does this code works with the new release of docfx 2.76.0 ?

JM2K69 avatar Apr 12 '24 08:04 JM2K69

does this code works with the new release of docfx 2.76.0?

It's not implemented yet. It can enable markdig alerts syntax with following configurations.

"markdownEngineProperties": {
      "markdigExtensions": [
        "Alerts"
      ]
    },

But currently markdig alerts is not works as expected. Additional tasks are required to display markdig alerts.

  • Removing existing QuoteSectionNoteExtension when markdig alert is enabled.
  • Add custom CSS styles to support markdig alerts.

filzrev avatar Apr 12 '24 08:04 filzrev