Open fatso83 opened 6 years ago
markdown-toc
returns an object with a .content
property that contains the results from rendering the toc
. It looks like markdown-pdf
is expecting a string or buffer to be returned since that's what it's pushing into the stream.
The only option I'm thinking of at this time is to create a new option for mardown-toc
that will return the .content
instead of the object. If someone could do a PR with that (or any additional ideas), I'm open to reviewing and discussing it.
@doowb Does that mean I should file the report to markdown-pdf
instead? I wasn't sure which party is non-conforming to some standard/convention.
@fatso83 if you'd like to open an issue at markdown-pdf
you could do that to request that they check the output of .render
and if it's an object use .content
. But, I think it would be better to update it here by adding an option, then you can use that option when registering your plugin.
Created the following minimal script which works fine when I uncomment the
toc.plugin
line, but fails otherwise withTypeError: Invalid non-string/buffer chunk
. After browsing the documentation of Remarkable and this plugin, I can't seem to find that I am doing something wrong ...Output from command with stacktrace
```javascript node non-working.js ../README.md events.js:182 throw er; // Unhandled 'error' event ^ TypeError: Invalid non-string/buffer chunk at chunkInvalid (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_readable.js:306:10) at readableAddChunk (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_readable.js:260:31) at DestroyableTransform.Readable.push (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_readable.js:245:10) at DestroyableTransform.Transform.push (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_transform.js:148:32) at DestroyableTransform.flush [as _flush] (/home/carlerik/dev/holmevann/scripts/node_modules/markdown-pdf/index.js:77:12) at DestroyableTransform.prefinish (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_transform.js:138:10) at emitNone (events.js:105:13) at DestroyableTransform.emit (events.js:207:7) at prefinish (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_writable.js:609:14) at finishMaybe (/home/carlerik/dev/holmevann/scripts/node_modules/readable-stream/lib/_stream_writable.js:617:5) ```These are my dependencies: