Skip to content

Commit

Permalink
add a new pattern list 'gfm' which is more natural in GFM and pandoc …
Browse files Browse the repository at this point in the history
…syntax
  • Loading branch information
yihui committed Mar 18, 2012
1 parent 7e292d6 commit d11b96d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/defaults.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ all_patterns =
inline.code = '<!--\\s*rinline\\s*([^>]*)\\s*-->',
global.options = '<!--\\s*roptions\\s*([^>]*)\\s*-->',
header.begin = '\n*\\s*<head>',
ref.label = '^## @knitr (.*)$'))
ref.label = '^## @knitr (.*)$'),

`gfm` = list(chunk.begin = '^``` \\{r (.*)\\}\\s*$',
chunk.end = '^````\\s*$',
ref.chunk = '^\\s*<<(.*)>>\\s*$',
inline.code = '`ri\\s+([^`]*)\\s+ir`',
global.options = '`ro\\s+([^`]*)\\s+or`',
ref.label = '^## @knitr (.*)$'))

#' Options for the knitr package
#'
Expand Down
3 changes: 3 additions & 0 deletions R/pattern.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ pat_tex = function() set_pattern('tex')
#' @rdname pat_fun
#' @export
pat_html = function() set_pattern('html')
#' @rdname pat_fun
#' @export
pat_gfm = function() set_pattern('gfm')

## helper functions

Expand Down

0 comments on commit d11b96d

Please sign in to comment.