Closed nsainaney closed 2 years ago
so you would like to have a new option:
that you can use to add some plantUML commands that will be then injected at the begin of each diagram?
I think It is something we can do.
The only issue is related to the options api. At the moment I cannot create a textarea in the options but only a text input that can contain only one line.
I will ask to add the textarea in the options api and in the meanwhile we will find a workaround.
Do you prefer to have the limitation of only one line of header? or maybe it is better to have multiple lines that are comma separated?
Not sure comma would work as I believe comma's could be part of the UML code.
What about a path to a file that contains headers? The path could be ~/.joplin-desktop/my-plant-uml-header.iuml
or wherever the user wants. Are you able to read the user's local computer? If not, it could be a note that contains the header.
But we could also wait for the Joplin folks to add textarea.
I released the version 1.4.0 that contains the feature you requested. Let me know if it is what you expect and if it is working fine.
Hey Mark, Awesome work! Looks great:
With (my plantumlheader.iuml)
!theme cerulean-outline
skinparam linetype ortho
I get:
Some minor feedback. If you use path.resolve
, relative paths like ~/.config/joplin-desktop/planumlheader.iuml
will work. Also, you can use fs/promises so you don't have to do all that stuff with Buffer etc.
import fs from 'fs/promises'
import path from 'path'
...
async function readFileContent(filename: string): Promise<string> {
const absolutePath = path.resolve(filename)
const content = await fs.readFile(absolutePath, 'utf8')
return content
}
I really appreciate the feature! Please feel free to close the issue.
Thanks for your feedback. I'm using fs-extra because there is a bug in webpack that prevent me to use the basic fs module.
One day I will may be able to fix it. I implemented your changes and you can now use relative paths.
Thanks for the great plugin!
The Obsidian PlantUML plugin allows for injecting a header into every PlantUML diagram (after @startuml):
This makes it easy to inject headers like the following that are universal to all diagrams:
Would love to see this added!