Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long-line in source code block cause js error #47

Closed
wych42 opened this issue Jun 3, 2020 · 5 comments
Closed

Long-line in source code block cause js error #47

wych42 opened this issue Jun 3, 2020 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@wych42
Copy link

wych42 commented Jun 3, 2020

Describe the bug
long-line in source code block will case js error and page not loading

console error:

TypeError: Cannot read property 'offsetHeight' of undefined
    at hn.pageHeadHeight ((index):427)
    at hn.handleScroll ((index):408)
    at hn.mounted ((index):472)
    at _t (vue.min.js:6)
    at hn.$mount (vue.min.js:6)
    at hn.$mount (vue.min.js:6)
    at hn._init (vue.min.js:6)
    at new hn (vue.min.js:6)
    at (index):388

To Reproduce
put this to any post.md

 {{< highlight plaintext "hl_lines=3 " >}}
 elasticsearch_1  | {"type": "server", "timestamp": "2020-05-26T02:27:46,322Z", "level": "INFO", "component": "o.e.c.s.ClusterApplierService", "cluster.name": "docker-cluster", "node.name": "es02.host.fqdn", "message": "master node changed {previous [], current [{es01.host.fqdn}{ofLOlsGZT_OgBfJVyr1I0Q}{2vdYT2RGT92uqH4v8S3duQ}{ip.ad.dr.es}{ip.ad.dr.es:9320}{dilm}{ml.machine_memory=201400594432, ml.max_open_jobs=20, xpack.installed=true}]}, added {{es01.host.fqdn}{ofLOlsGZT_OgBfJVyr1I0Q}{2vdYT2RGT92uqH4v8S3duQ}{ip.ad.dr.es}{ip.ad.dr.es:9320}{dilm}{ml.machine_memory=201400594432, ml.max_open_jobs=20, xpack.installed=true}}, term: 4, version: 80, reason: ApplyCommitRequest{term=4, version=80, sourceNode={es01.host.fqdn}{ofLOlsGZT_OgBfJVyr1I0Q}{2vdYT2RGT92uqH4v8S3duQ}{ip.ad.dr.es}{ip.ad.dr.es:9320}{dilm}{ml.machine_memory=201400594432, ml.max_open_jobs=20, xpack.installed=true}}" }
 {{< /highlight >}}

Environment
Hugo Static Site Generator v0.70.0/extended darwin/amd64 BuildDate: unknown
Chrome

@AmazingRise AmazingRise added the duplicate This issue or pull request already exists label Jun 3, 2020
@AmazingRise
Copy link
Owner

Go #46

@wych42
Copy link
Author

wych42 commented Jun 3, 2020

It may not be duplicate. In my issue, if source code line is not that long, pages render properly.
e.g:

  {{< highlight plaintext "hl_lines=3 " >}}
  highlight
  {{< /highlight >}}

image

I tested with command hugo serve --disableFastRender -D -t ../.. inside exampleSite dir.

@AmazingRise
Copy link
Owner

After the lastest commit, the webpage is rendered correctly here.
图片

@AmazingRise
Copy link
Owner

It may not be duplicate. In my issue, if source code line is not that long, pages render properly.
e.g:

  {{< highlight plaintext "hl_lines=3 " >}}
  highlight
  {{< /highlight >}}

image

I tested with command hugo serve --disableFastRender -D -t ../.. inside exampleSite dir.

This source code contains {{ }}, which will be processed by Vue.js

 {{< highlight plaintext "hl_lines=3 " >}}
 elasticsearch_1  | {"type": "server", "timestamp": "2020-05-26T02:27:46,322Z", "level": "INFO", "component": "o.e.c.s.ClusterApplierService", "cluster.name": "docker-cluster", "node.name": "es02.host.fqdn", "message": "master node changed {previous [], current [{es01.host.fqdn}{ofLOlsGZT_OgBfJVyr1I0Q}{2vdYT2RGT92uqH4v8S3duQ}{ip.ad.dr.es}{ip.ad.dr.es:9320}{dilm}{ml.machine_memory=201400594432, ml.max_open_jobs=20, xpack.installed=true}]}, added {{es01.host.fqdn}{ofLOlsGZT_OgBfJVyr1I0Q}{2vdYT2RGT92uqH4v8S3duQ}{ip.ad.dr.es}{ip.ad.dr.es:9320}{dilm}{ml.machine_memory=201400594432, ml.max_open_jobs=20, xpack.installed=true}}, term: 4, version: 80, reason: ApplyCommitRequest{term=4, version=80, sourceNode={es01.host.fqdn}{ofLOlsGZT_OgBfJVyr1I0Q}{2vdYT2RGT92uqH4v8S3duQ}{ip.ad.dr.es}{ip.ad.dr.es:9320}{dilm}{ml.machine_memory=201400594432, ml.max_open_jobs=20, xpack.installed=true}}" }
 {{< /highlight >}}

And in the latest commit, I added a v-pre outside the post content, and the {{}} will be escaped as expected.

So I think it's may be duplicated.
But anyway, thanks for your feedback.

If there is any further problems, please feedback here, or close this issue.

@wych42
Copy link
Author

wych42 commented Jun 3, 2020

Thanks. Confirm fixed.

@wych42 wych42 closed this as completed Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants