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 the ability to link to pages #81

Open
ehsteve opened this issue Dec 1, 2021 · 5 comments
Open

Add the ability to link to pages #81

ehsteve opened this issue Dec 1, 2021 · 5 comments

Comments

@ehsteve
Copy link

ehsteve commented Dec 1, 2021

Setup and configuration

  • Mermaid version:3.0.1
  • MediaWiki version:1.35.2
  • PHP version:7.4.16
  • Database system (MySQL, PostgresQL, etc.) and version:Postgres 13.4

Issue

This is not a bug but a feature request. It would be great if mermaid graphs could link back to mediawiki pages. For example, a Gantt chart section could link to a page to provide more details. Same for a graph element.

@kghbln
Copy link
Member

kghbln commented Dec 2, 2021

For graphs this works already using Mermaid's click feature: See the example on sandbox Not sure if it works for Gantt charts etc.

@ehsteve
Copy link
Author

ehsteve commented Dec 3, 2021

@kghbln thanks for pointing that out. That does seem to work though not for all elements in a gantt chart and in a way that is not very mediawiki friendly. For example, you have to hard code the web address as opposed to using the standard bracket notation. Also, it seems like only time bars can be changed to clickable and not other elements such as section names or milestone text. Section names are what I am most interested in being able to link to a page since they represent specific subjects. I understand that some of these limitations may come directly from mermaid and would have to be fixed there though I don't know which are which.

@kghbln
Copy link
Member

kghbln commented Dec 3, 2021

If I am not mistaken, others may correct me here, this extension just wraps Mermaid code and allows to add it to a wiki page. Thus most of the changes need to be done at Mermaid I presume.

@ehsteve
Copy link
Author

ehsteve commented Dec 8, 2021

That may be true perhaps the only thing that would be appropriate here is to enable bracket linking for internal links?

@djinnet
Copy link

djinnet commented Jun 14, 2022

@kghbln I want to point out that example on sandbox is broken. I got 404 error when I am clicking on the link. I think it got moved somewhere elsewhere or it got taken down?

I am interesting in this issue as well, since I have the same use case feature as @ehsteve do.

At first I thought it was possible with [[InternalLink]] in the text, then it breaks. Then I read upon securityLevel and I tried it out based on this setup:

{{#mermaid:graph BT;
A[AAA] -->|Test| B[BBB]
A[AAA] -->|Test| C[[[InternalLink]]]
C -->|Test| D[DDD]
C -->|Test| E[EEE]
|
config.theme = dark
config.securityLevel = loose
}}

But it is broken. Then I tried just without the internal link and it still is broken, until I found out that config.securityLevel is the one who caused the error. It works fine without internallink and without securityLevel.
Do both of ya know how I can resolve this securityLevel issue?

EDIT: Nevermind! Found out that I missed an " | " between theme and securityLevel and that solved the issue, but I still can't get the internal links. But for now I can use the antiscript or loose value in the securityLevel and use the a href tag instead, but it feels dirty to be honest when it is primary used for external links and not internal links.

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

No branches or pull requests

3 participants