SemanticMediaWiki / Mermaid

Provides a parser function to generate diagrams and flowcharts with the help of the mermaid script language
https://www.mediawiki.org/wiki/Extension:Mermaid
Other
36 stars 24 forks source link

Add flowchart useMaxWidth config parameter #41

Closed cicalese closed 5 years ago

cicalese commented 5 years ago

This PR is made in reference to: #40

This PR addresses adds support for the flowchart useMaxWidth config parameter. It is activated by passing in 'config.flowchart.useMaxWidth=false' to the #mermaid parser function invocation, similar to the current 'config.theme=forest' and 'config.flowchart.curve=basis' parameters.

Scrollbars can be added to the area, if desired, with the following CSS in MediaWiki:Common.css (or elsewhere):

.ext-mermaid > div {
    overflow: scroll;
}

In adding the new parameter, the configuration parameter parsing code was also refactored to make it easier to add additional configuration parameters in the future. Also, white space around the equals sign in the parameter was trimmed.

This PR includes:

Fixes #

kghbln commented 5 years ago

@cicalese Thanks a ton for the pull. @mwjames and @JeroenDeDauw It will be cool to have a peep at this which would result into Mermaid 2.2.0 :)

mwjames commented 5 years ago

@cicalese Thanks a ton for the full. @mwjames and @JeroenDeDauw It will be cool to have a peep at this which would result into Mermaid 2.2.0 :)

I have very limited time to review changes before 2020, so if you think those changes are reasonable crafted then please merge at your own discretion.

On 10/9/19, Karsten Hoffmeyer notifications@github.com wrote:

@cicalese Thanks a ton for the full. @mwjames and @JeroenDeDauw It will be cool to have a peep at this which would result into Mermaid 2.2.0 :)

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/SemanticMediaWiki/Mermaid/pull/41#issuecomment-539882006

JeroenDeDauw commented 5 years ago

That's unfortunate. I had a look at this yesterday and concluded I cannot understand this code without investing a bunch of time.

cicalese commented 5 years ago

I have added an example to the sandbox at https://sandbox.semantic-mediawiki.org/wiki/Wide_Mermaid_Graph. If the patch is applied to the sandbox, you will see the difference in the behavior. You can see the same example with the patch applied at https://wikifarm.wmflabs.org/cpt/index.php/User:Ccicalese/Wide_Mermaid_Graph.

You can see an example of a large graph that currently benefits from the patch at https://wikifarm.wmflabs.org/cpt/index.php/Graph_Active_CPT_Tasks_by_Initiative?initiative=MCR (although this graph may change in the future if the source task data being graphed changes). Before the patch was applied, this graph was scaled down so much it was unreadable.

Note that this pull request also adds two tests.

kghbln commented 5 years ago

I have very limited time to review changes before 2020, so if you think those changes are reasonable crafted then please merge at your own discretion.

We have a test passing, the test instance does not blow: I am now merging this. If sandbox does not blow withing the next week I will even do a release to get this improvement to the general public.

kghbln commented 5 years ago

@cicalese Thanks for your effort and the pull!

cicalese commented 5 years ago

Thank you, @kghbln!

samwilson commented 5 years ago

This is great!

Could a new release please be tagged?

kghbln commented 5 years ago

Could a new release please be tagged?

No, there currently so many issues from upstream (MediaWiki) that I frankly lost the overview of things. When it comes to this extension this nonsense will have to be resolved: https://github.com/SemanticMediaWiki/Mermaid/issues/21

I expect the next realest to be done somewhere in the second quarter 2020. Sorry but I am on my own here and moreover I am not a PHP developer.