Skip to content

Instantly share code, notes, and snippets.

@silkentrance
Last active November 19, 2021 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silkentrance/917b6ba0017eeb9684379073a51b63aa to your computer and use it in GitHub Desktop.
Save silkentrance/917b6ba0017eeb9684379073a51b63aa to your computer and use it in GitHub Desktop.
Confluence Server : Display Embedded SVG inline
Add the following to your confluence server Custom HTML (At end of HEAD)
```
<style type="text/css">
.confluence-embedded-file[data-mime-type="image/svg+xml"] span {
display: none;
visibility: hidden;
}
</style>
<script>
AJS.$(document).ready(function() {
AJS.$(".confluence-embedded-file[data-mime-type='image/svg+xml'").each(function () {
const elem = $(this);
const url = elem.data('file-src');
const children = elem.children();
children[0].src = url;
});
});
</script>
```
This will replace the placeholder URL of the img with the actual URL of the attachment.
It will also hide the span.
Tested with both page local attachments and attachments from other pages.
@silkentrance
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment