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

<pre class=include-code> ignores the last line if there's no newline when line numbers are required #2521

Closed
FeignClaims opened this issue Apr 8, 2023 · 3 comments

Comments

@FeignClaims
Copy link

<pre class=include-code>
  path: text.txt
  highlight: text
</pre>

text.txt:

1 line
2 line
3 line

but only output:

1 line
2 line
@tabatkins
Copy link
Collaborator

First, apologies for the delay! No idea how I completely missed this issue coming in.

Second, huh, I can't reproduce this. Is it still happening for you?

@FeignClaims
Copy link
Author

FeignClaims commented Apr 19, 2023

Second, huh, I can't reproduce this. Is it still happening for you?

I retried it again and found that the problem actually occurs when asking for the line number to be displayed (either by line-numbers or line-highlight). That is,

This will ignore the last line if there's no newline:

<pre class=include-code>
  path: text.txt
  highlight: text
  line-numbers: on
</pre>

This displays correctly:

<pre class=include-code>
  path: text.txt
  highlight: text
</pre>

@FeignClaims FeignClaims changed the title <pre class=include-code> ignores the last line if there's no newline <pre class=include-code> ignores the last line if there's no newline when line numbers are required Apr 19, 2023
@tabatkins
Copy link
Collaborator

Ah, thanks for isolating it! Indeed, I was using a slightly wrong check to see if there was anything leftover at the end of my "stuff the text into line-number wrappers" loop, which would accidentally say there wasn't when it was only text!

Fixed now, I'll do a release in a bit with the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants