Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add feature to configure markdig extension by docfx.json configs. #9820

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Mar 27, 2024

This PR supersede #9780.

This PR intended to add functionality to override settings for some specific Markdig extensions.

Changed behaviors

  1. When markdig extension name ONLY specified.
    -> Then try to add or replace extension with markdig default options. (Used to reset docfx default settings)
  2. When markdig extension name with options are specified.
    -> Then try to add or replace extension with specified options.

Other markdig extensions that have not customizable configs are processed same as before..
(By using MarkdownPipelineBuilder.Configure method ).


What's changed in this PR

  1. Add MarkdigExtensionSetting.cs file.
  • This class represent extension name with custom options.
  • options are hold with System.Text.JsonElement
  1. Add MarkdigExtensionSettingConverter.cs file.
  • This class convert json config to MarkdigExtensionSetting object.
  1. Modify MarkdownExtensions.cs logics.
  • If known extension names are passed. It try to add or replace markdig extension with specified options.
  1. Modify MarkdownServiceParameters.cs
  • MarkdigExtensions propety type is changed from string[] to MarkdigExtensionSetting.
  1. Update public API contracts file (Api.verified.cs)
  2. Add unit tests for markdig extension that can specify custom option settings.

Additional Notes
Original reported feature requests (#9762 / #9772) are resolved by this PR.
By using following configurations.

{
  "build": {
    "markdownEngineProperties": {
      "markdigExtensions": [
        "EmphasisExtras",
        "Emojis"
      ]
    }
  }
}

If it need to specify options.
Pass options properies with extension name.

markdigExtensions: [
    "FootNotes",
    { "Emojis": { "options": {  "enableSmileys": true } },
    { "AutoIdentifiers": { "options": "default" } },
    { "MediaLinks": { "options": { "width": 800, "height": 400 }} 
]

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 60.86957% with 45 lines in your changes are missing coverage. Please review.

Project coverage is 78.95%. Comparing base (fe673ec) to head (f25547f).
Report is 98 commits behind head on main.

Files Patch % Lines
...ine.Extensions/MarkdigExtensionSettingConverter.cs 28.57% 30 Missing ⚠️
...arkdigEngine.Extensions/MarkdigExtensionSetting.cs 64.70% 10 Missing and 2 partials ⚠️
...cfx.MarkdigEngine.Extensions/MarkdownExtensions.cs 92.10% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9820      +/-   ##
==========================================
+ Coverage   74.31%   78.95%   +4.63%     
==========================================
  Files         536      538       +2     
  Lines       23189    23311     +122     
  Branches     4056     4049       -7     
==========================================
+ Hits        17234    18406    +1172     
+ Misses       4853     3780    -1073     
- Partials     1102     1125      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yufeih yufeih added the new-feature Makes the pull request to appear in "New Features" section of the next release note label Apr 1, 2024
Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @filzrev !

@yufeih yufeih merged commit 3be044e into dotnet:main Apr 1, 2024
7 checks passed
@filzrev filzrev deleted the feat-markdig-extension-override2 branch April 1, 2024 13:47
renovate bot added a commit to buehler/dotnet-operator-sdk that referenced this pull request Apr 7, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [docfx](https://togithub.com/dotnet/docfx) | `2.75.3` -> `2.76.0` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/docfx/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/docfx/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/docfx/2.75.3/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/docfx/2.75.3/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>dotnet/docfx (docfx)</summary>

### [`v2.76.0`](https://togithub.com/dotnet/docfx/releases/tag/v2.76.0)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### 🎉 New Features

- feat: Add DefineConstants supports for source file based build by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9707
- feat: Add additional layout options to modern template by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9737
- feat: Add pdfPrintBackground setting by
[@&#8203;cjlotz](https://togithub.com/cjlotz) in
[dotnet/docfx#9742
- feat: Update roslyn packages by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9753
- feat: Publish nightly pre-release packages by
[@&#8203;yufeih](https://togithub.com/yufeih) in
[dotnet/docfx#9788
- feat: Add DLL references support for file-based API metadata
generation by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9825
- feat: Support DOCFX_SOURCE_REPOSITORY_URL by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9759
- feat: Add feature to configure markdig extension by docfx.json
configs. by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9820
- feat: Support for all emphasis supported by MarkDig by
[@&#8203;EMaderbacher](https://togithub.com/EMaderbacher) in
[dotnet/docfx#9762

##### 🐞 Bug Fixes

- fix: `docfx download` command behaviors by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9721
- fix: Resolved .NET SDK version problem on source-based API metadata
generation by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9713
- fix: Don't overwrite `_disabledToc` when metadata is explicitly
defined by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9741
- fix: Outputted PDF displays garbled characters when name contains
non-ASCII chars by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9769
- fix: Move script tags into head in modern template by
[@&#8203;fuzzykiller](https://togithub.com/fuzzykiller) in
[dotnet/docfx#9768
- fix: Broken examples problems when using inheritdoc tag by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9754
- fix: NullReferenceException occurred when both include and exclude are
null by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9786
- fix: Change JsonSchema EvaluationOptions instance to shared object by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9807
- fix: Bug fix Invalid documentation on type parameter
[#&#8203;9755](https://togithub.com/dotnet/docfx/issues/9755) by
[@&#8203;soniyaprasad77](https://togithub.com/soniyaprasad77) in
[dotnet/docfx#9806

##### 🚀 Performance Improvements

- perf: Optimize xrefmap.json file deserialization performance by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9824

##### 🔧 Engineering

- chore: percy snapshot by [@&#8203;yufeih](https://togithub.com/yufeih)
in
[dotnet/docfx#9747
- chore: Add detailed error message for specific exceptions by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9746
- chore: update pdfpig nuget package version by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9803

##### 📄 Documentation

- docs: Split docfx CLI reference docs based on commands by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9708
- docs: Update markdown documentation regarding MarkDig extension by
[@&#8203;tbolon](https://togithub.com/tbolon) in
[dotnet/docfx#9810
- docs: Update `docfx.json` config reference document by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9813
- docs: Correct `docfx template` page title by
[@&#8203;peitschie](https://togithub.com/peitschie) in
[dotnet/docfx#9812
- docs: Add a warning about relative path resolution. by
[@&#8203;voroninp](https://togithub.com/voroninp) in
[dotnet/docfx#9828

#### New Contributors

- [@&#8203;EMaderbacher](https://togithub.com/EMaderbacher) made their
first contribution in
[dotnet/docfx#9762
- [@&#8203;fuzzykiller](https://togithub.com/fuzzykiller) made their
first contribution in
[dotnet/docfx#9768
- [@&#8203;soniyaprasad77](https://togithub.com/soniyaprasad77) made
their first contribution in
[dotnet/docfx#9806
- [@&#8203;tbolon](https://togithub.com/tbolon) made their first
contribution in
[dotnet/docfx#9810
- [@&#8203;peitschie](https://togithub.com/peitschie) made their first
contribution in
[dotnet/docfx#9812
- [@&#8203;voroninp](https://togithub.com/voroninp) made their first
contribution in
[dotnet/docfx#9828

**Full Changelog**:
dotnet/docfx@v2.75.3...v2.76.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9pm,before 6am" in timezone
Europe/Zurich, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/buehler/dotnet-operator-sdk).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
ian-buse pushed a commit to dh2i-devs/dotnet-operator-sdk that referenced this pull request May 3, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [docfx](https://togithub.com/dotnet/docfx) | `2.75.3` -> `2.76.0` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/docfx/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/docfx/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/docfx/2.75.3/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/docfx/2.75.3/2.76.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>dotnet/docfx (docfx)</summary>

### [`v2.76.0`](https://togithub.com/dotnet/docfx/releases/tag/v2.76.0)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### 🎉 New Features

- feat: Add DefineConstants supports for source file based build by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9707
- feat: Add additional layout options to modern template by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9737
- feat: Add pdfPrintBackground setting by
[@&#8203;cjlotz](https://togithub.com/cjlotz) in
[dotnet/docfx#9742
- feat: Update roslyn packages by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9753
- feat: Publish nightly pre-release packages by
[@&#8203;yufeih](https://togithub.com/yufeih) in
[dotnet/docfx#9788
- feat: Add DLL references support for file-based API metadata
generation by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9825
- feat: Support DOCFX_SOURCE_REPOSITORY_URL by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9759
- feat: Add feature to configure markdig extension by docfx.json
configs. by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9820
- feat: Support for all emphasis supported by MarkDig by
[@&#8203;EMaderbacher](https://togithub.com/EMaderbacher) in
[dotnet/docfx#9762

##### 🐞 Bug Fixes

- fix: `docfx download` command behaviors by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9721
- fix: Resolved .NET SDK version problem on source-based API metadata
generation by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9713
- fix: Don't overwrite `_disabledToc` when metadata is explicitly
defined by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9741
- fix: Outputted PDF displays garbled characters when name contains
non-ASCII chars by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9769
- fix: Move script tags into head in modern template by
[@&#8203;fuzzykiller](https://togithub.com/fuzzykiller) in
[dotnet/docfx#9768
- fix: Broken examples problems when using inheritdoc tag by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9754
- fix: NullReferenceException occurred when both include and exclude are
null by [@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9786
- fix: Change JsonSchema EvaluationOptions instance to shared object by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9807
- fix: Bug fix Invalid documentation on type parameter
[#&#8203;9755](https://togithub.com/dotnet/docfx/issues/9755) by
[@&#8203;soniyaprasad77](https://togithub.com/soniyaprasad77) in
[dotnet/docfx#9806

##### 🚀 Performance Improvements

- perf: Optimize xrefmap.json file deserialization performance by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9824

##### 🔧 Engineering

- chore: percy snapshot by [@&#8203;yufeih](https://togithub.com/yufeih)
in
[dotnet/docfx#9747
- chore: Add detailed error message for specific exceptions by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9746
- chore: update pdfpig nuget package version by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9803

##### 📄 Documentation

- docs: Split docfx CLI reference docs based on commands by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9708
- docs: Update markdown documentation regarding MarkDig extension by
[@&#8203;tbolon](https://togithub.com/tbolon) in
[dotnet/docfx#9810
- docs: Update `docfx.json` config reference document by
[@&#8203;filzrev](https://togithub.com/filzrev) in
[dotnet/docfx#9813
- docs: Correct `docfx template` page title by
[@&#8203;peitschie](https://togithub.com/peitschie) in
[dotnet/docfx#9812
- docs: Add a warning about relative path resolution. by
[@&#8203;voroninp](https://togithub.com/voroninp) in
[dotnet/docfx#9828

#### New Contributors

- [@&#8203;EMaderbacher](https://togithub.com/EMaderbacher) made their
first contribution in
[dotnet/docfx#9762
- [@&#8203;fuzzykiller](https://togithub.com/fuzzykiller) made their
first contribution in
[dotnet/docfx#9768
- [@&#8203;soniyaprasad77](https://togithub.com/soniyaprasad77) made
their first contribution in
[dotnet/docfx#9806
- [@&#8203;tbolon](https://togithub.com/tbolon) made their first
contribution in
[dotnet/docfx#9810
- [@&#8203;peitschie](https://togithub.com/peitschie) made their first
contribution in
[dotnet/docfx#9812
- [@&#8203;voroninp](https://togithub.com/voroninp) made their first
contribution in
[dotnet/docfx#9828

**Full Changelog**:
dotnet/docfx@v2.75.3...v2.76.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9pm,before 6am" in timezone
Europe/Zurich, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/buehler/dotnet-operator-sdk).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
…s. (dotnet#9820)

feat: Add support to configure markdig extension by configuration.

Co-authored-by: Yufei Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Makes the pull request to appear in "New Features" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants