Skip to content

Commit

Permalink
escape backticks in raw output
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed May 2, 2024
1 parent b593d6d commit c4ab661
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: emphatic
Type: Package
Title: Highlight R Output using Colouring
Version: 0.1.6.9007
Title: Highlight R Output using Colour
Version: 0.1.6.9008
Author: mikefc
Maintainer: mikefc <[email protected]>
Description: User-defined colouring of data.frames and other R output.
Description: User-defined colour of data.frames and other R output.
URL: https://coolbutuseless.github.io/package/emphatic/, https://github.com/coolbutuseless/emphatic
BugReports: https://github.com/coolbutuseless/emphatic/issues
License: MIT + file LICENSE
Expand Down
7 changes: 3 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# emphatic 0.1.6.9006 2024-05-01
# emphatic 0.1.6.9008 2024-05-02

* Removed `hl_mat()` and associated vignettes.
* function is not exported for now as the selection process is too
Expand All @@ -11,9 +11,8 @@
rendered to PDF
* Remove `scale_mode` argument to `hl()`
* Support for output to `typst` in quarto docs
* Updated the list of characters to escape for typst
* Switched to `raw` text blocks for output as they have better overflow
behaviour. Still not perfect, but better!
* Output to raw blocks in typst
* only character to be escaped is the backtick

# emphatic 0.1.6 2024-04-27

Expand Down
15 changes: 1 addition & 14 deletions R/core-typst.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,7 @@ underline_off_typst <- "]"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
escape_typst <- function(x) {
x <- enc2utf8(x)
# x = gsub("([#$%&_{}])", "\\\\\\1", x)
# x <- gsub(" ", "\\\\u{00a0}", x, useBytes = TRUE)
# x <- gsub("<" , "\\\\<", x, useBytes = TRUE)
# x <- gsub("#" , "\\\\#", x, useBytes = TRUE)
# x <- gsub("_" , "\\\\_", x, useBytes = TRUE)
# x <- gsub("~" , "\\\\~", x, useBytes = TRUE)
# x <- gsub("~" , '\\\\"', x, useBytes = TRUE)
# x <- gsub("@" , "\\\\@", x, useBytes = TRUE)
# x <- gsub("`" , "\\\\`", x, useBytes = TRUE)
# x <- gsub("\\*" , "\\\\*", x, useBytes = TRUE)
# x <- gsub("\\[" , "\\\\[", x, useBytes = TRUE)
# x <- gsub("\\]" , "\\\\]", x, useBytes = TRUE)
# x <- gsub("\\$" , "\\\\$", x, useBytes = TRUE)
# x <- gsub("\n" , "\\\\\n", x, useBytes = TRUE)
x <- gsub("`" , '`#raw("`")`', x, useBytes = TRUE)
Encoding(x) <- 'UTF-8'
x
}

0 comments on commit c4ab661

Please sign in to comment.