Skip to content

Add documentation to add Mermaid.js to Gitea #9872

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

Merged
merged 4 commits into from
Jan 20, 2020

Conversation

zeripath
Copy link
Contributor

Add documentation to https://docs.gitea.io/en-us/customizing-gitea/ to show how to add Mermaid.js to Gitea.

Relevant #3340
Relevant #9553

@zeripath zeripath added the type/docs This PR mainly updates/creates documentation label Jan 19, 2020
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jan 19, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 19, 2020
}
```

If you want Mermaid.js outside of markdown you would move the above script tags to just after the scripts loading jquery. Mermaid will detect and use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside markdown, what does that mean? If you have html or other external render?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you write html files or want to use it in your templates

<script>mermaid.init(".language-mermaid")</script>
```

to `footer.tmpl` within the `{{if .RequireHighlightJS}}...{{end}}` block
Copy link
Contributor

@davidsvantesson davidsvantesson Jan 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better with a tmpl within the custom folder. Add a new custom/extra_highlight.tmpl?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the site admin has to place this code within base/footer.tmpl it would require to be updated in case of other changes. Better to have a specific custom file for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok it turns out that it being in custom/footer.tmpl doesn't break anything. It just means that it needs to be loaded everytime I guess we could stick a {{if .RequirHighlightJS}}....{{end}} around it?

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@12f6939). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #9872   +/-   ##
=========================================
  Coverage          ?   42.31%           
=========================================
  Files             ?      605           
  Lines             ?    79313           
  Branches          ?        0           
=========================================
  Hits              ?    33563           
  Misses            ?    41609           
  Partials          ?     4141

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12f6939...95924cd. Read the comment docs.

@techknowlogick techknowlogick merged commit 27c6b8f into go-gitea:master Jan 20, 2020
@zeripath zeripath deleted the docs-mermaid branch January 20, 2020 16:40
@@ -100,6 +100,45 @@ Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful temp
- `body_outer_post.tmpl`, before the bottom `<footer>` element.
- `footer.tmpl`, right before the end of the `<body>` tag, a good place for additional Javascript.

#### Example: Mermaid.js

If you would like to add [mermaid.js](https://mermaid-js.github.io/) support to Gitea's markdown you simply add:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this link is already 404.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bloody hell

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've sent another PR

@rprieto rprieto mentioned this pull request May 13, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants