gmunguia / markdown-it-plantuml

:herb: :book: plantuml diagrams in your markdown
MIT License
98 stars 21 forks source link

customGenerator's URL not used #13

Closed ThaDaVos closed 5 years ago

ThaDaVos commented 5 years ago

I created a custom generator which returns a custom url for loading the image (this url goes to a local path where plantuml diagrams are generated using node-plantuml) but even though I'm returning a new url when checking the generated source files when building (I'm using VuePress) it still shows the url to the plantuml server... why?

My console.logs in my custom generate source function are being executed...

gmunguia commented 5 years ago

Hi! Could you show (though a gist or just copying your code in this issue) how you pass that generator to the library, and the body of that generator?

ThaDaVos commented 5 years ago

Here it is: https://gist.github.com/dvdbot/a690f72064f797e9ec96db971560b7ed

I'm also noticing that when building webpack always generates the same hashes for the files...

gmunguia commented 5 years ago

I had a look and tried to reproduce the issue. I commented out the if/else in line 22 to force md to always use markdown_it_plantuml_options_production. In that scenario, other parts of the program failed (probably because I don't have the same folder structure than you), but the generated markdown contained the local URL as expected.

Could you try forcing the use of prod config like I did, to discard an issue with this library?

ThaDaVos commented 5 years ago

I also tried that but it didn't seem to work - let me try again

ThaDaVos commented 5 years ago

For me it isn't working but like I said - the webpack always generates the same hashes...

Where are you looking for the url?

gmunguia commented 5 years ago

I checked the URL in the html produced in dist/index.html.

ThaDaVos commented 5 years ago

It says plantuml.com for me...

ThaDaVos commented 5 years ago

Something else is acting fishy I think...

ThaDaVos commented 5 years ago

NVM, this issue can be closed - just tried it on a collegue's pc and it just works there - so, somehow my webpack is broken and keeps re-using the same cache - if you know why, please enlight me 😂

ThaDaVos commented 5 years ago

btw, quick question - is it possible to get the name from the uml itself? See below (it's officially supported by PlantUML itself) and I kind of need it for pre-genning the images @startuml {NAME} @enduml

gmunguia commented 5 years ago

There is no way to obtain that parameter within the generator function, but you can create a new ticket requesting that feature 😄 .

ThaDaVos commented 5 years ago

Just did - hope it's clear enough https://github.com/gmunguia/markdown-it-plantuml/issues/14