diff --git a/index.js b/index.js index 6b32ea7..c7e0dc7 100755 --- a/index.js +++ b/index.js @@ -92,7 +92,7 @@ const LowConfidenceMode = { exit: "exit" }; -const options = {}; +const readabilityOptions = {}; //backwards compat with old, comma-separated values function yargsCompatProperties(args) { @@ -215,7 +215,7 @@ let args = yargs .option("keep-classes", { alias: 'C', type: "boolean", - desc: __`Preserve all classes on HTML elements`, + desc: __`Preserve all CSS classes for input elements, instead of adding custom classes`, default: false, }) .option("output", { @@ -308,7 +308,7 @@ if (args["url"]) { } if (args["keep-classes"]) { - options["keepClasses"] = true; + readabilityOptions["keepClasses"] = true; } @@ -475,7 +475,7 @@ function onLoadDOM(dom) { if (!args["quiet"]) console.error(__`Processing...`); - const reader = new Readability(window.document, options); + const reader = new Readability(window.document, readabilityOptions); const article = reader.parse(); if (!article) { if (args["low-confidence"] == LowConfidenceMode.keep) { @@ -504,19 +504,22 @@ function onLoadDOM(dom) { for (propertyName of wantedProperties) writeStream.write(Properties.get(propertyName)(article, true, window) + '\n'); } else { - const cssHref = args["style"] || "chrome://global/skin/aboutReader.css"; - writeStream.write(` - - + `); + if (args["style"] || !args["keep-classes"]) { + const cssHref = args["style"] || "chrome://global/skin/aboutReader.css"; + writeStream.write(` + `); + } + writeStream.write(` ${escapeHTML(Properties.get("title")(article, false, window), window.document)} ` ); - if (!args["style"]) { + if (!args["keep-classes"]) { //Add a few divs and classes so that Firefox Reader Mode CSS works well writeStream.write(`