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

Per line spans #146

Merged
merged 5 commits into from
Jun 22, 2022
Merged

Per line spans #146

merged 5 commits into from
Jun 22, 2022

Conversation

hadley
Copy link
Member

@hadley hadley commented Jun 21, 2022

@hadley hadley changed the title Apply a span per line Per line spans Jun 21, 2022
Copy link
Contributor

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Some snapshot files need to be updated though. Here are the patch you can apply based on what I get by using the pandoc package to run the tests with specific pandoc version according to your GHA runs

Pandoc 2.10.1

diff --git a/tests/testthat/test-downlit-md-v21.txt b/tests/testthat/test-downlit-md-v21.txt
index d449295..8ac255e 100644
--- a/tests/testthat/test-downlit-md-v21.txt
+++ b/tests/testthat/test-downlit-md-v21.txt
@@ -3,7 +3,7 @@
 
 > cat(downlit_md_string("```\nbase::t(1)\n```"))
 <pre class='chroma'>
-<span class='nf'>base</span><span class='nf'>::</span><span class='nf'><a href='https://rdrr.io/r/base/t.html'>t</a></span><span class='o'>(</span><span class='m'>1</span><span class='o'>)</span></pre>
+<span><span class='nf'>base</span><span class='nf'>::</span><span class='nf'><a href='https://rdrr.io/r/base/t.html'>t</a></span><span class='o'>(</span><span class='m'>1</span><span class='o'>)</span></span></pre>
 
 > cat(downlit_md_string(brio::read_lines(test_path("markdown-table.md"))))
 Table: Caption [`base::t`](https://rdrr.io/r/base/t.html)

Pandoc 2.9.2.1

diff --git a/tests/testthat/test-downlit-md-v20.txt b/tests/testthat/test-downlit-md-v20.txt
index abdb0c2..d8cdc1d 100644
--- a/tests/testthat/test-downlit-md-v20.txt
+++ b/tests/testthat/test-downlit-md-v20.txt
@@ -3,8 +3,7 @@
 
 > cat(downlit_md_string("```\nbase::t(1)\n```"))
 <pre class='chroma'>
-<span class='nf'>base</span><span class='nf'>::</span><span class='nf'><a href='https://rdrr.io/r/base/t.html'>t</a></span><span class='o'>(</span><span class='m'>1</span><span class='o'>)</span>
-</pre>
+<span><span class='nf'>base</span><span class='nf'>::</span><span class='nf'><a href='https://rdrr.io/r/base/t.html'>t</a></span><span class='o'>(</span><span class='m'>1</span><span class='o'>)</span></span></pre>
 
 > cat(downlit_md_string(brio::read_lines(test_path("markdown-table.md"))))
 Table: Caption [`base::t`](https://rdrr.io/r/base/t.html)

Pandoc 2.7.3

previous patch should also fix the runs

If that helps, patchs files are in the zip for use with git apply

patch-file.zip

@hadley
Copy link
Member Author

hadley commented Jun 22, 2022

Thanks for the patches! (And looking forward to the pandoc package 😄)

@hadley hadley merged commit cfc4082 into main Jun 22, 2022
@hadley hadley deleted the span-per-line branch June 22, 2022 14:51
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.

Multline strings formatted incorrectly? highlight() output is missing per-line <span>
2 participants