How do you specify Mermaid configuration within Gitlab Markdown? - gitlab

In Gitlab, I've been able to render an Entity Relationship Diagram with Mermaid in a Markdown file as specified here.
This is the Markdown I used:
```mermaid
erDiagram
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
CUSTOMER ||--o{ ORDER : places
CUSTOMER ||--o{ INVOICE : "liable for"
DELIVERY-ADDRESS ||--o{ ORDER : receives
INVOICE ||--|{ ORDER : covers
ORDER ||--|{ ORDER-ITEM : includes
PRODUCT-CATEGORY ||--|{ PRODUCT : contains
PRODUCT ||--o{ ORDER-ITEM : "ordered in"
```
The mermaid interactive editor provides an example of configuration:
{
"theme": "default"
}
But I don't know where to locate that configuration information. I've tried putting it in the same directory, in a file called config.json or mermaid-config.json, but neither of those have worked. I also tried including it in the Markdown which defined the diagram, which only caused it to render incorrectly. Is there a way to specify the theme or other CSS elements for Gitlab?

Just tried it out and it worked
```mermaid
%%{init: { 'theme':'dark', 'sequence': {'useMaxWidth':false} } }%%
sequenceDiagram
alice ->> mark: Sent a flower
```

Edit: If you are using a recent enough version of GitLab (possibly 13.9.0 from February, 2021, which changes the shipped version of Mermaid from 8.5.2 to 8.9.0) you can use directives, as mentioned in the other answers:
```mermaid
%%{init: { 'logLevel': 'debug', 'theme': 'dark' } }%%
graph LR
%%{config: { 'fontFamily': 'Menlo', 'fontSize': 18, 'fontWeight': 400} }%%
A-->B
```
Note that Mermaid seems to be sensitive to newlines here. If I add a blank line between graph LR and the following %%{config line I get a syntax error.
Original answer for older versions of GitLab:
I don't believe you can, unless you want to self-host and modify the GitLab source code.
The Mermaid.js configuration in GitLab is largely hard-coded. It looks like it uses the neutral theme by default and switches to the dark theme if
the user is using dark or solarizedDark as their web IDE theme, and
if the user is on the IDE web page.

Unfortunately current GitLab uses mermaidjs version 8.5.2 as per merge request
From mermaid 8.6 onward you should be able to use directives to set the theme and/or other settings without touching the hard coded css. For example:
%%{init: { 'theme': 'forest' } }%%
erDiagram
...
I'm afraid we have to wait a little longer, until GitLab updates to this version. You can check in the meantime mermaids doc on the matter. You can includes this already in your markdown, as the %% is interpreted as comments and will not show up in the rendering. But when GitLab makes the move, your pages should immediately update.

Related

Custom page template not showing up when using a pagebuilder theme (mostly Elementor)

I've installed a theme (that i bought) that's mainly made with Elementor.
Since I've been running into some issues with customizing this theme, (and still refuse to also pay money for Elementor Pro) I decided it would be easier to create a custom template myself.
I have done this before when I used a custom theme I made myself from scratch (I thought I was saving myself some time this time around...).
So my problem: I saved this template called page-home.php to my Child theme (that I made of the purchased Theme) in a folder called page templates.
It is not showing in the drop down menu when creating a new page.
I then just copied it to the main theme, activated that...and still not showing.
Is this because the Theme is using a page builder like Elementor?
Or do you think the creator of the theme somehow disabled this option?
Thanks in advance for any help.
As far as I know Elementor ignores the most of the standard theme file. It does so i.e. with the header.php for sure. The question is what do you want to put in a theme file what you couldn't do with Elementor. Have a look at the
"Hello Theme" https://github.com/elementor/elementor/issues/14283 - it's a plain theme.
If you don't want to pay for Pro, I recommand the plugin "Elementor – Header, Footer & Blocks Template" (and for better editor handling: "Flexible Elementor Panel")

Shopware 6 template inheritance issue

I have a Plugin that adds something to the Product detail page and I want to make some changes to it.
That shouldn't be a problem, right? I just can do that in my Theme, but NO that doesn't work!
Here are the views attribute of my theme.json
"views": [
"#Storefront",
"#Plugins",
"#MegaTmlTheme",
"#MegaTrainingProducts"
],
And here is a Screenshot of the Profiler (Template Inheritance)
I want to change the accessory-product.html.twig, but as you can see, the Plugin template is loaded after the one from the Theme.
WHY? And how do I fix that?
In which order did you install Plugin and Theme?
The order seems to be depenend on the installation date.
See also
How to do a template multiple inheritance in Shopware 6?
and
In which order are Shopware 6 plugins loaded?

openNtf debugToolbar UI is overridden by extLib's Bootstrap3 theme

This relates to an Xpages project using openNtf's Extension Library for Domino 9.0.1 V 16 (2016-01-28). There is a custom theme applied that extends extLib's Bootstrap3 theme.
Now I also applied Mark Leusink's debugToolbar Plugin (V 4.0.1, 2014-03-10).
Unfortunately all tables that are display inside the toolbar are partially "destroyed", as in this example:
Debugging the resulting html I see that the "label" cells of the debug table are assigned class="label" or class="label wide". Unfortunately bootstrap.css applies a display: inline style to a .label selector.
Currently I solved this by applying my own custom css file to reset toolbar styling; but I wonder whether there might be a more elegant way, maybe some kind of property that I simply missed out here. Or is this something that have to be done within the toolbar's source code?
Please add this as a defect on the project, so the contributor is aware and can resolve.
Alternatively, download the source code from https://github.com/OpenNTF/DebugToolbar, contribute the fix and make a pull request.
Hopefully Paul's and my entries at github and within the openntf.org project will help resolving this issue. Meanwhile my workaround seems to be the only option here;
As I mentioned above I created a custom styleSheet with just one line in it:
div.dBar table.grid td.label{display:table-cell;}
Then I created a cusom control as a container for the debug toolbar so that I could link my custom style sheet as a resource. The debug custom control finally is added to all the xpages where I want to have the toolbar.
Maybe this can help others, too.

Enlarge the quick panel of sublime text

I am looking for a way to enlarge the quick panel (when you type Ctrl + Alt + P and then select install Package) because when I want to install a new package from the Package Control, I can't see the whole github link.
I thought the configuration was in a sublime-theme file but I can't find the property to make the width bigger.
In fact I am using the Phoenix theme so I created a Phoenix Dark.sublime-theme in my User folder and I tried different values for quick_panel playing with padding and margin. Nothing is correct.
[
{
"class": "quick_panel",
"row_padding": [0, 2]
},
{
"class": "quick_panel_row",
"layer0.texture": "Theme - Phoenix/Phoenix Dark/quick-panel-row.png",
"layer0.inner_margin": [2, 2, 2, 2]
}
]
If this is not possible, maybe there is something to display the details of a package?
if someone have an idea?
Thnks
If you're just looking for the Github link, the Package Control website is a great resource. It's fully searchable (package name and short description), and each package's page presents a nice combination of data, including the README from Github/bitbucket, info on Sublime versions and platforms supported, installation statistics so you can see how popular a particular package is and when it was last updated, and links to the project's Issues page as well as a Gittip link in case you want to donate to support the author(s). I usually do all my research there first, then go to the Command Palette quick panel when I'm ready to install.

URL based breadcrumbs display

Is it possible to show breadcrumbs based on the URL. For example if the user hits example.com it means home->test1->test and if user hits example1.com it means home->test2->test. Is it possible to control the breadcrumbs visibility. Any one guide me how to do this.
A very nice implementation of A very customizable breadcrumb can be found in the Zen theme. If you already use a sub-theme of Zen then you're in luck. You;ll only probably have to configure it and you're good to go.
Options for the breadcrumb: each theme has it's own settings. So you'll need to add the options you'll want for youre breadcrumb (On/Off, separator, home link On/Off etc.) in a themes/your_theme_name/theme-settings.php file. Here you'll find a starting point. For inspiration check out the theme-settings.php (for defining the options) and zen.info file (for providing the default values for the options).
Theme the breadcrumb: then you'll have to implement your_theme_name_breadcrumb function in template.php. Again look in the file with the same name in the Zen theme for an example.
Showing the breadcrumb: last step is to make sure that your breadcrumb is visible and you do this by printing the $breadcrumb variable. Look in the page.tpl.php file template for the default implementation and customize it as you like.
Some other points of interests:
Custom breadcrumbs haven't tried it personally but sounds promising if you're looking for customizable breadcrumb trails for node types.
An article on the above mentioned Drupal module
for those who like to get their hands dirty here you can find some nice info: http://drupal.org/node/64067
And don't forget to clear the theme cache at the end :)

Resources