Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flowchart useMaxWidth config parameter #41

Merged
merged 2 commits into from Nov 9, 2019

Conversation

cicalese
Copy link
Contributor

@cicalese cicalese commented Oct 8, 2019

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:

  • Tests (unit/integration)
  • CI build passed

Fixes #

The useMaxWidth parameter controls whether the diagram will be scaled to fit the available width. The default for this parameter is true, meaning that the diagram will be scaled. For very wide diagrams, this can result in an unreadably small diagram. Setting useMaxWidth to false allows the diagram to remain at a fixed sized. Scrollbars can be added to the area, if desired, with:

.ext-mermaid > div {
	overflow: scroll;
}
The useMaxWidth parameter controls whether the diagram will be scaled to
fit the available width. The default for this parameter is true, meaning
that the diagram will be scaled. For very wide diagrams, this can result
in an unreadably small diagram. Setting useMaxWidth to false allows the
diagram to remain at a fixed sized. Scrollbars can be added to the area,
if desired, with:

.ext-mermaid > div {
	overflow: scroll;
}
@kghbln
Copy link
Member

kghbln commented Oct 9, 2019

@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
Copy link
Contributor

mwjames commented Oct 10, 2019 via email

@JeroenDeDauw
Copy link
Member

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

@cicalese
Copy link
Contributor Author

cicalese commented Nov 8, 2019

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
Copy link
Member

kghbln commented Nov 9, 2019

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 kghbln merged commit 4c91bf5 into SemanticMediaWiki:master Nov 9, 2019
@kghbln
Copy link
Member

kghbln commented Nov 9, 2019

@cicalese Thanks for your effort and the pull!

@cicalese
Copy link
Contributor Author

Thank you, @kghbln!

@samwilson
Copy link

This is great!

Could a new release please be tagged?

@kghbln
Copy link
Member

kghbln commented Nov 23, 2019

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: #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.

@cicalese cicalese mentioned this pull request Mar 7, 2020
@cicalese cicalese mentioned this pull request Sep 3, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants