-
Notifications
You must be signed in to change notification settings - Fork 868
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
[Feature Request] Add PlantUML support to enable migrations onto latest version of docfx #9566
Comments
It thought it can be implemented with following steps.
Example code: filzrev@2e227b0 Note
|
@filzrev thanks so much for the info - giving it a go to see what I can come up with |
@filzrev I've done a POC to see if I can get the rendering of Plantuml up and running. I used the extensibility points you pointed out, but based the implementation on the I had a look at the existing extensions to see which of these require configuration. The {
"markdownEngineProperties":
{
"alerts": {
"TODO": "alert alert-secondary"
},
"plantUml": {
"remoteUrl" : "https://www.plantuml.com/plantuml/",
"outputFormat" : "svg"
}
}
} So any extension can add their configuration as a new key in the existing configuration. All we then need is a mechanism for the specific extension to get hold of their configuration. As all extensions can have access to the public class QuoteSectionNoteExtension : IMarkdownExtension
{
private readonly MarkdownContext _context;
private readonly Dictionary<string, string> _notes = new(StringComparer.OrdinalIgnoreCase)
{
["NOTE"] = "NOTE",
["TIP"] = "TIP",
["WARNING"] = "WARNING",
["IMPORTANT"] = "IMPORTANT",
["CAUTION"] = "CAUTION",
};
public QuoteSectionNoteExtension(MarkdownContext context)
{
_context = context;
var config = _context.GetExtensionConfiguration("Alerts");
if (config != null)
{
foreach (var (key, value) in config)
_notes[key] = value;
}
}
.... I implemented something similar for the Here's a link to my commit where I implemented all of this. Any feedback on this would be much appreciated. I wrote one or two tests to verify the changes to the existing and new implementations, but I'm struggling to get the whole tool chain running on my machine. If the approach I'm following is acceptable, I can look at creating a pull request for this with additional feedback included. |
@cjlotz Thank you for putting this together, this commit looks absolute great! The approach looks good to me, my only question is how does PlantUML themes work with docfx templates that supports dark/light mode. Can we switch themes dynamically in the browser using CSS/JS, or are the themes baked into the resulting SVG? If latter, we may need to generate 2 SVGs to be able to switch between light/dark in the browser. |
@yufeih Not an expert on PlantUML themes, but a theme is added directly into the code block that is transformed to a SVG. We use specific themes to render some specific type of architecture diagrams more elegantly, From these discussions it does not seem possible to dynamically switch the theme. I was not aware that docfx currently supports the dynamic switching of images based on theme based on unresolved feature requests like this. For us, the ability to render PlantUML regardless of the light/dark theme using the latest docfx is what we are looking for as a starting point. This will allow us to move our technical docs forward using docfx due to our considerable investment in PlantUml. Otherwise, we will have to migrate to other alternatives like JetBrains Writerside which is starting to look promising but still missing the dynamic features of docfx which we also use extensively as part of our tech doc pipelines. Not to mention the considerable effort from our side for such a migration. My suggestion is to land the PlantUml support and create a subsequent feature request to look at light/dark mode support. The code as it stands with the current commit is fully functional. I tested a local copy of this on all our technical docs and the diagrams rendered successfully. The tests also run through barring for some failures on the What are your current thoughts on taking this forward? |
@cjlotz Sounds like a good plan. Would you like to send a pull request? |
Is your feature request related to a problem? Please describe.
We have been using plantuml and the docfx plantuml plugin to create of our technical documentation. The latest versions of docfx does not support plantuml with support being limited to mermaid diagrams.
Describe the solution you'd like
To continue using the latest versions of docfx we need plantuml support. We are willing to write a plugin that supports the feature set, but we are unclear as to where to start, what extensibility points to use etc. Can somebody please provide us with the relevant hooks/mechanisms to implement/override to enable this? It seens like we need to create a Markdig diagrams extension? The old plugin is based on the DFM syntax which I believe is not supported going forward. Any pointers will be much appreciated.
The text was updated successfully, but these errors were encountered: