question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No way to prevent insertion of inlined SVG images, and instead insert raw HTML

See original GitHub issue

Sphinx-Gallery version used:

  • 0.4.0
  • latest version compatible with Python 3.6

We are working on GLM Reporter . The feature takes some args and generates a report, which contains many inlined SVG images. The entire report is a string, including the code for the generated SVG images.

This string is wrapped as HTMLDocument object (nilearn.plotting.js_plotting_utils.HTMLDocument).

When we run make html on this, the GLM Reporter function is executed, and all the images created as SVG’s (they are not saved to disk by the feature) are saved to disk and inserted into the HTML.

The HTML code, which we would want inserted, perhaps as an iframe, is not.

I have bundled the 4 files I think are pertinent to demonstrate what I am saying and maybe help reproduce & troubleshoot. This includes the .py source, the .rst and .html generated by Sphinx-gallery, as well the report this PR creates, containing the HTML we would like inserted into the gallery example.

The source .py file for the example is also at https://github.com/nistats/nistats/blob/43ebb718619a0e5021d7faa3a12c090cc5f7177e/examples/02_first_level_models/plot_adhd_dmn.py

The section I speak of is right at the bottom of the page.

Is there anyway to do one or the things we want without editing the raw html generated?

Attached:

example-files.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
larsonercommented, Aug 22, 2019

FYI this was the whole PR originally (has some styles that might help you tweak things)

https://github.com/mne-tools/mne-python/pull/6433/files

1reaction
larsonercommented, Aug 30, 2019

I commented over on your PR, you need to modify sphinx_gallery_conf. I’ll close this since I think no action is needed from the SG end, but feel free to reopen if something ends up missing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Best Way to Embed SVG on HTML (2021) - Vecta.io
What's the best way to embed SVGs in HTML 5? How does embedding SVGs using Img tags, Object tags, Inline SVG differs among...
Read more >
Do I use <img>, <object>, or <embed> for SVG files?
If you want a non-interactive svg, use <img> with script fallbacks to png version (for older IE and android < 3). One clean...
Read more >
Adding vector graphics to the web - Learn web development
Objective: Learn how to embed an SVG (vector) image into a webpage. ... inserting SVGs using CSS background images means that the SVG...
Read more >
How to Use SVG Images in CSS and HTML – A Tutorial for ...
SVG images do not lose their quality when zoomed or resized. ... This method is the simplest way to add SVG images to...
Read more >
How to use SVGs in React | Sanity.io guide
There are a few ways to use an SVG in a React app: Use it as a regular image; Import it as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found