Closed waldyrious closed 1 year ago
This works, but feels rather hacky. @not-my-profile do you have any suggestions here?
In any case, I eventually would like to do a more deliberate handling of Docutils' output, rather than directly accept the full HTML page it produces (see #5), so perhaps this is OK as a stop-gap solution.
For the record, the DOM manipulation approach would look something like this:
const newStyle = outputFrame.contentDocument.createElement("style");
newStyle.textContent = "body { background-color: unset; }";
outputFrame.contentDocument.head.appendChild(newStyle);
Update: I found a cleaner approach, thanks to https://stackoverflow.com/a/13959836/266309.
I force-pushed the branch to allow for a clean git history; for reference, the original commit was 2cfa017ae.
Merging since this no longer uses a hacky string replacement approach.
This has to be done via string manipulation instead of DOM manipulation, because the iframe's contents are set by passing a string with HTML markup to the
srcdoc
attribute (see PR #12).Fixes #15.