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

fix windows EOL in markdown files #1911

Merged
merged 2 commits into from
Jun 23, 2022
Merged

fix windows EOL in markdown files #1911

merged 2 commits into from
Jun 23, 2022

Conversation

agrandville
Copy link
Contributor

zola v0.15.3
os windows

if ```linenos is enable in codeblock and EOL is windows style (0xD,0x0A) vs unix style (0x0A),
code highlighting failed.

image

Text are borrowed, to sanitize the CR+LF to LF, the strings are split in parts.
To reconstruct the string, parts must be concatenated.
cf pulldown-cmark/pulldown-cmark#507

check

> cargo test  --test=codeblocks --package=markdown
running 21 tests
test can_add_line_numbers_windows_eol ... ok
test can_add_line_numbers_with_lineno_start ... ok
test can_add_line_numbers_with_highlight ... ok
test can_add_line_numbers ... ok
test can_highlight_all_lines ... ok
test can_hide_lines ... ok
test can_highlight_at_end ... ok
test can_highlight_line_range ... ok
test can_highlight_out_of_bounds ... ok
test can_highlight_mix_line_ranges ... ok
test can_highlight_ranges_overlap ... ok
test can_highlight_reversed_range ... ok
test can_highlight_single_line ... ok
test can_highlight_single_line_range ... ok
test can_highlight_unknown_lang ... ok
test can_highlight_weird_fence_tokens ... ok
test can_render_multiple_shortcodes_in_codeblock ... ok
test can_highlight_zero_start_same_as_one ... ok
test does_nothing_with_highlighting_disabled ... ok
test can_render_shortcode_in_codeblock ... ok
test can_render_completely_mixed_codeblock ... ok

test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.57s

The CodeBlock text events are now concatenated and processed in a single stream at the end. cf pulldown-cmark/pulldown-cmark#457
@Keats Keats merged commit 18e8246 into getzola:next Jun 23, 2022
@Keats
Copy link
Collaborator

Keats commented Jun 23, 2022

Thanks!

theowenyoung added a commit to theowenyoung/zola that referenced this pull request Jul 8, 2022
* 'next' of github.com:getzola/zola:
  Apply orientation transformation based on EXIF data (getzola#1912)
  Stop printing invalid files in dirs
  fix windows EOL in markdown files (getzola#1911)
  Properly escape anchor names (getzola#1908)
  Allow new lines before anchor (getzola#1905)
  Fix incorrect documentation for syntax directory (getzola#1901)
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

Successfully merging this pull request may close these issues.

2 participants