Skip to content

Commit

Permalink
Merge pull request #19 from waldyrious/rm-grey-bg
Browse files Browse the repository at this point in the history
Remove grey background from docutils' output
  • Loading branch information
waldyrious authored Dec 17, 2022
2 parents 6c75f05 + 26627ce commit 95d414a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ async function rstToHtml() {
`);

outputFrame.srcdoc = result;

// Override Docutils' default style, which adds a grey background to the body element.
// We need to wait until the iframe's load event; see https://stackoverflow.com/a/13959836/266309.
outputFrame.addEventListener("load", event => {
const newStyle = outputFrame.contentDocument.createElement("style");
newStyle.textContent = "body { background-color: unset; }";
event.target.contentDocument.head.appendChild(newStyle);
});
} catch (err) {
const pre = document.createElement('pre');
pre.textContent = err;
Expand Down

0 comments on commit 95d414a

Please sign in to comment.