Force monospace for raw text HTML pages

pull/69/head
Thomas Buckley-Houston 2018-06-23 19:02:06 +08:00
rodzic 2350000cfb
commit d4cb55f91e
1 zmienionych plików z 16 dodań i 2 usunięć

Wyświetl plik

@ -41,9 +41,9 @@ export default (MixinBase) => class extends MixinBase {
}
raw_text += "\n";
}
const head = `<html><title>${document.title}</title><body><pre>`
const head = this._getHTMLHead();
const date_time = this._getCurrentDataTime();
info += "\n\n" + `Built by <a href="https://www.brow.sh">Browsh</a> on ${date_time}`
info += "\n\n" + `Built by <a href="https://www.brow.sh">Browsh</a> on ${date_time}`;
if (this.dimensions.is_page_truncated) {
info += '\nBrowsh parser: the page was too large, some text may have been truncated.';
}
@ -51,6 +51,20 @@ export default (MixinBase) => class extends MixinBase {
return head + raw_text + foot;
}
_getHTMLHead() {
return `<html>
<head>
<title>${document.title}</title>
<style>
html * {
font-family: monospace;
}
</style>
</head>
<body>
<pre>`;
}
_getCurrentDataTime() {
let current_date = new Date();
const offset = -(new Date().getTimezoneOffset() / 60);