frantic1048/rst-live-preview

Remove default arguments passed to rst2html5

Opened this issue · 3 comments

marianoguerra/rst2html5#87

It is possible to use docutil's rst2html5.py script:

diff --git a/rst-loader.js b/rst-loader.js
index 6f8dbf6..9307120 100644
--- a/rst-loader.js
+++ b/rst-loader.js
@@ -4,7 +4,7 @@ var path = require('path');
 module.exports = function(rst) {
   var argv = [
     // enable syntax parsing
-    '--pygments',
+    // '--pygments',

     // use short class name to fit stylesheet
     '--syntax-highlight=short',
@@ -14,7 +14,7 @@ module.exports = function(rst) {
   ].concat(this.options.rst.argv);

   this.cacheable();
-  var rst2html5 = spawn('rst2html5', argv);
+  var rst2html5 = spawn('rst2html5', argv, {shell: true});
   var callback = this.async();

   var result = ''; // store rendered html

Maybe we can have an option for this.

To the first thing, we may update installation section in README.

And the second, do you mean an option that disable --pygments ?

I add --pygments and the following --syntax-highlight arguments means to make rst-live-preview just work out of box.

On the other hand, could you describe a scene that need to modify existing --pygments ? If it is really needed. We could remove all the preset arguments, and write instructions about them for users.

The problem is that rst2html5 from docutils doesn't have --pygments option:

rST preview runs on localhost:7508
Hash: 861ec26824f86f50dc52
Version: webpack 1.14.0
Time: 1538ms

ERROR in ./README.rst
Module build failed: Error: Usage
=====
  rst2html5.py [options] [<source> [<destination>]]

rst2html5.py: error: no such option: --pygments

    at ChildProcess.<anonymous> (D:\Dev\rst-live-preview\rst-loader.js:38:13)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
webpack: Failed to compile.

Here is the result from rst2html5 --version && rst2html5 --help: https://gist.github.com/eight04/214d4dd9d3532c85b4478ff0c126ccf3

Removing preset arguments sounds good. It might be even better to let users pass other options to rst2html5.

All right, I'll remove the default arguments passed to rst2html5 to make things clear. ><