asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
147 stars 50 forks source link

plantuml libraries across multiple documents #274

Closed romkavt closed 2 years ago

romkavt commented 3 years ago

Hello!

I am trying to implement PlantUML library of:

to be shared across multiple documents and multiple Git documentation repositories. I see the constraint: the path sandbox in plantuml preprocessing limiting "!include" to the document directory.

This is feature request to allow https URI's outside document directory and/or a property to include specific text to all rendered plantuml files (to include library source using kroki-preprocessor)

anb0s commented 3 years ago

Hi,

i've implemented the support via kroki-plantuml-include-paths for multiple local search locations. It may not work for http URI's yet, but It can be extended.

For the second you can use kroki-plantuml-include...

see: https://github.com/Mogztter/asciidoctor-kroki#configuration

romkavt commented 3 years ago

Hi! thanks, but unusable(

I using asciidoctor-kroki.js online in browser environment to render the documents from Atlassian BitBucket.

I seeking the ideas how to inject common stylesheet as https url or a piece of plantuml code. I would be grateful for some ideas how to do this

romkavt commented 3 years ago

I thinking about this topic. I've used preprocessor in asciidoctor.js to apply a set of style-related attributes (such as table captions, default toc layout and other) allowed to override in end document code.

My vote for implementing the 'prepocessor' extensions feature in asciidoctor-kroki.js by the similar way to asciidoctor.js - the ability to define user function to preprocess plantuml files

ggrossetie commented 3 years ago

Interesting idea... but not sure what is the best way to implement such feature.

As mentioned by @anb0s we could also extend the current "preprocessor" to load content from URI.

I need to give it more thought.

ggrossetie commented 3 years ago

@romkavt could you please describe in detail your use case and show what you tried and/or what you wish for (but not working currently)?

I want to understand if we can support this use case "out-of-the-box" or if we should provide an extension point.

Thanks!

romkavt commented 3 years ago

We are building architecture repository using a set of asciidoctor documents with hyperlinks to each other. Users views architecture repository online, in browser environment. Asciidoctor documents contains Archimate, UML, C4 diagrams implemented by PlantUML.

We had implemented the asciidoctor text common styling using CSS stylesheet and preprocessor (to inject overridable attributes). Now we have a task to:

  1. implement common PlantUML stylesheet
  2. implement standard library with Archimate & UML symbols of our systems

today we are using !include directive with absolute URL's and local file paths. We have to move PlantUML symbols library to a separate Git repository, re-usable by many asciidoctor documents in different directories and different Git repositories. Every PlantUml document contains a bunch of !include macro.

We are using Git backend as repository storage. !include links have to point to correct branch. branch can be determined by javascript code using URL of root asciidoctor document.

I think we have two options to implement this:

  1. inject !include macro using pre-processor function
  2. implement it's own macros which will be transformed to correct absolute urls by preprocessor

As an example of macro-preprocessing: the hyperlinks between multiple asciidoctor documents. We've implemented the macro {uri-repository-root}. Hyperlinks will be expanded by pre-processor to absolute url's including exact git branch. The example of hyperlink in asciidoctor document:

link:{uri-repository-root}/solutions/tokenization/somesolution/index.html[Description]