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

[kramdown] images attributes on new line are ignored #119

Open
zkamvar opened this issue Apr 18, 2023 · 1 comment
Open

[kramdown] images attributes on new line are ignored #119

zkamvar opened this issue Apr 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@zkamvar
Copy link
Contributor

zkamvar commented Apr 18, 2023

When processing images, a pattern like this is ignored by the parser so that the kramdown to pandoc conversion misses it:

tmp <- withr::local_tempfile()
writeLines(c("![test image](https://example.com/img.jpg)", "{.image-with-shadow width='50%'}"), tmp)
pegboard::Episode$new(tmp)$use_sandpaper()$show()
#> ---
#> ~
#> ---
#> 
#> ![](https://example.com/img.jpg){alt='test image'}
#> {.image-with-shadow width='50%'}

Created on 2023-04-18 with reprex v2.0.2

@zkamvar zkamvar added the bug Something isn't working label Apr 18, 2023
@zkamvar zkamvar self-assigned this Apr 18, 2023
@zkamvar
Copy link
Contributor Author

zkamvar commented Apr 19, 2023

Note: this still needs a bit of work because figure attributes on new lines are not allowed (afaict):

pandoc::pandoc_convert(text = "![a](link)\n{alt='b'}", to = "html")
#> <p><img src="link" alt="a" /> {alt=‘b’}</p>
pandoc::pandoc_convert(text = "![a](link){alt='b'}", to = "html")
#> <figure>
#> <img src="link" alt="b" />
#> <figcaption>a</figcaption>
#> </figure>

Created on 2023-04-18 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant