diff --git a/src/AsciiDocProvider.ts b/src/AsciiDocProvider.ts index cccc3eb6..cb2b09a2 100644 --- a/src/AsciiDocProvider.ts +++ b/src/AsciiDocProvider.ts @@ -173,9 +173,22 @@ export default class AsciiDocProvider implements TextDocumentContentProvider { errorMessage += "Go to `File -> Preferences -> User settings` and adjust the AsciiDoc.asciidoctor_command" resolve(this.errorSnippet(errorMessage)); }) + + var result_data = '' asciidoctor.stdout.on('data', (data) => { - let result = this.fixLinks(data.toString(), doc.fileName); - resolve(this.buildPage(result)); + const string_data = data.toString(); + const received_len = Buffer.byteLength(string_data); + /* This seems to work for large outputs, but several questions remains: + Is there a 64k limit from nodejs in the data received ? + Or is it depend on the ascidoctor output buffering/flush mechanism ? + Will the concatenation work across multiple async stdout.on calls ? + */ + if(received_len < 65536) + { + resolve(this.buildPage(this.fixLinks(result_data + string_data, doc.fileName))); + } + else + result_data += string_data }); asciidoctor.stdin.write(text); asciidoctor.stdin.end(); diff --git a/test/samples/simple.adoc b/test/samples/simple.adoc index 1c7ad2fa..80c06d32 100644 --- a/test/samples/simple.adoc +++ b/test/samples/simple.adoc @@ -6,7 +6,7 @@ Preview as you type, including formatting like *this*, or _this_. == You can also add your custom CSS style It will automatically refresh, just as you type -== Heading level 2kv +== Heading level 2 Diferrente heading levels are easly procuded with the # symbol . You can also do _italic_ or *bold* like in the more common mark down.