# Hugo with asciidoctor incomplete rendering

**URL:** <https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417>\
**Category:** support\
**Tags:** asciidoc\
**Created:** [September 7, 2022, 8:33am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417 "2022-09-07T08:33:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 7, 2022, 8:33am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/1 "2022-09-07T08:33:48Z")

</div>

### What version of Hugo are you using (`hugo version`)?

```
$ hugo version
hugo v0.101.0+extended darwin/arm64 BuildDate=unknown
```

### Does this issue reproduce with the latest release?

No.

### OS

MacOS Monterey Version 12.4  
Apple M1

### config

```yaml
markup:
  asciidocExt:
    backend: "html5"
    extensions: []
    failureLevel: "fatal"
    noHeaderOrFooter: true
    preserveTOC: false
    safeMode: "unsafe"
    sectionNumbers: false
    trace: false
    verbose: false
    workingFolderCurrent: false

```

### asciidoctor --version

Asciidoctor 2.0.17 [[https://asciidoctor.org](https://asciidoctor.org)]  
Runtime Environment (ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

### node\_modules must has ./bin/asciidoctor

```bash
npm i @asciidoctor/core asciidoctor-pdf --save-dev

```

then add node script to package.json

```auto
"scripts": {
    "server": "hugo server",
},

```

then run the script

```auto
npm run server

```

### Bug

if content too long, about more than 1400 lines,  
the .Page.Content is only show some content, not complete rendering.

The end content is missing.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 7, 2022, 3:00pm UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/2 "2022-09-07T15:00:28Z")

</div>

I am unable to reproduce the problem with a test file (content/post/test.adoc) that contains over 2500 paragraphs.

Try it:

```bash
git clone --single-branch -b hugo-forum-topic-40417 https://github.com/jmooring/hugo-testing hugo-forum-topic-40417
cd hugo-forum-topic-40417
npm run server

```

  
hugo v0.102.3  
Asciidoctor 2.0.16

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 8, 2022, 4:13am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/3 "2022-09-08T04:13:55Z")

</div>

```bash
npm init -y
npm i @asciidoctor/core asciidoctor-pdf --save-dev

```

then add to the scripts of the package.json

```auto
...
"scripts": {
    "server": "hugo server",
},
...

```

then run

```auto
npm run server

```

reproduce the problem

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 8, 2022, 7:12pm UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/4 "2022-09-08T19:12:14Z")

</div>

I am still unable to reproduce the problem.

```bash
$ node --version
v18.9.0

$ npm --version
8.19.1

$ asciidoctor --version
Asciidoctor 2.0.16
Runtime Environment (ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu])

$ hugo version
hugo v0.102.3-b76146b129d7caa52417f8e914fc5b9271bf56fc+extended linux/amd64

```

Can you create a minimal reproducible example (repository) that we can clone and test?

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 3:04am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/5 "2022-09-09T03:04:28Z")

</div>

please do that follow

```auto
git clone https://github.com/zkaip/hugo-forum-topic-40417
cd hugo-forum-topic-40417
npm install
npm run server

```

Then reproduce the problem

 ![Screen Shot 2022-09-09 at 11.02.06](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/8/f/8fe0274ff6cc59ea49cfc67a369be632e0cec9c6.png)

note that

 ![Screen Shot 2022-09-09 at 11.02.32](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/c/0/c098748fca4c8f4ebafe9fcbb914aabd7d6ea0de.png)

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 9, 2022, 3:50am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/6 "2022-09-09T03:50:46Z")

</div>

`npm install` throws errors and does not complete.

```nohighlight
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN deprecated @fortawesome/fontawesome-common-types@0.3.0: Please upgrade to 6.1.0. https://fontawesome.com/docs/changelog/
npm WARN deprecated @fortawesome/fontawesome-svg-core@1.3.0: Please upgrade to 6.1.0. https://fontawesome.com/docs/changelog/
npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /home/jmooring/temp/hugo-forum-topic-40417/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c -- node install.js

npm ERR! A complete log of this run can be found in:
npm ERR! /home/jmooring/.npm/_logs/2022-09-09T03_46_32_508Z-debug-0.log

```

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 5:52am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/7 "2022-09-09T05:52:56Z")

</div>

> [@jmooring](#):
>
> `npm install` throws errors and does not complete.
> 
> ```auto
> 
> ```

you can remove the package-lock.json then `npm install`

My node version is v14.17

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 9, 2022, 6:02am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/8 "2022-09-09T06:02:27Z")

</div>

That makes no difference… `npm install` still throws errors. Downgraded node.js to v14.19.3 and had the same problem.

Sorry, but I can’t spend any more time on this. As stated earlier, the page is not truncated when running asciidoctor as a stand-alone application. Your problem seems to be related to running asciidoctor through node/npm.

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 6:08am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/9 "2022-09-09T06:08:08Z")

</div>

Yes, I use the stand-alone application asciidoctor to avoid this problem

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 6:14am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/10 "2022-09-09T06:14:03Z")

</div>

I circumvented the problem, but did not solve it.  
But still, thank you.

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 10:14am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/11 "2022-09-09T10:14:52Z")

</div>

> <https://github.com/asciidoctor/asciidoctor-cli.js/issues/196>
>
> If the CLI is used to pipe the result to stdout, the Invoker is not waiting for …the process to finish writing before calling exit. This situation occurs when the amount of output exceeds the write limit for a single tick. In other words, the write is not fully synchronous.
> 
> Here's a patch to \`convertFromStdin\` that will fix the problem when piping from stdin to stdout:
> 
> \`\`\`js
> if (options.to\_file === Opal.gvars.stdout) {
> await once(process.stdout.end(), 'close')
> }
> \`\`\`
> 
> However, I think this will be needed wherever to\_file is stdout.
> 
> In order to reproduce this problem, the \`asciidoctorjs\` bin script needs to be called via \`spawn\` (or similar). If the test pipes a large file to the command, it will not receive the whole converted file back to stdout without this patch.

this resolve it

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [September 11, 2022, 10:15am UTC](https://discourse.gohugo.io/t/hugo-with-asciidoctor-incomplete-rendering/40417/12 "2022-09-11T10:15:39Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
