Open zenhaust opened 1 year ago
Yeah, I can try this out! Sorry I took so long to respond. I'll have a stab at it this week
So I've got this working on my local machine and it seems good. I want to make sure I understand how things are meant to work, though, and I have a question:
These lines you've added to parseInjectMermaid($content, $function)
...
$blockBegin = str_replace("[","\\[",$blockBegin);
$blockBegin = str_replace("]","\\]",$blockBegin);
$blockEnd = str_replace("[","\\[",$blockEnd);
$blockEnd = str_replace("]","\\]",$blockEnd);
$blockEnd = str_replace("/","\\/",$blockEnd);
...were added so that, if someone sets the block-detector-*
configuration to [mermaid]
and [/mermaid]
, those values will be properly sanitized to the regular expression, correct?
If I'm right about that, then I'll proceed. I am going to set the default value of the delimiters to [mermaid] [/mermaid]
so as not to break the websites of people who update existing installations of our plugin.
Two last questions. First, would you prefer that I create a development branch on the repository where you can make a pull request? That way your work will be attributed to your GitHub account and stuff. If so, please write commit messages following this guide. Second, how would you like to be credited in the release notes?
Thanks for your help!
It´s correct. The str_replace
function escapes the special characters, so that the regular expression works properly.
In response to your first question, no problem. It seems good to me.
Please add me to the project so I can create a new branch.
Regarding your second question, I leave it under your consideration.
Thanks and regards
Hi.
This is a new feature for your consideration
Gitlab or Stackedit uses the syntax for mermaid code block recognition.
```mermaid mermaid code ```
Maybe you could add a new feature to set the block delimiters.
It could be something like that.
In mermaid-diagrams.yaml#L6 (General Settings) I add two new properties
In mermaid-diagrams.php#L40
I replace
by
And finaliy, the code in the method parseInjectMermaid, could look something like this
Thanks for your attention and regards.