diff --git a/R/block_articles.R b/R/block_articles.R index 2df94bae..5b0b98f0 100644 --- a/R/block_articles.R +++ b/R/block_articles.R @@ -5,8 +5,9 @@ #' a column of articles at lower screen widths). #' #' @param image An optional URL pointing to an image resource. -#' @param title An optional title for the article. -#' @param content An optional paragraph of text for the article. +#' @param title An optional title for the article. Markdown is supported. +#' @param content An optional paragraph of text for the article. Markdown is +#' supported. #' @param link An optional link to apply to the content elements. #' #' @examples @@ -19,7 +20,7 @@ #' title = "Hong Kong", #' content = #' "Once home to fishermen and farmers, \\ -#' modern Hong Kong is a teeming, \\ +#' modern _Hong Kong_ is a teeming, \\ #' commercially-vibrant metropolis where \\ #' Chinese and Western influences fuse.", #' link = "http://www.discoverhongkong.com" @@ -198,43 +199,63 @@ block_article_3 <- function(items) { ) } + paragraph <- "
" + x1_title <- glue::glue( article_title_template(), - title = items[[1]]$title, + title = + items[[1]]$title %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph), link = items[[1]]$link ) x2_title <- glue::glue( article_title_template(), - title = items[[2]]$title, + title = + items[[2]]$title %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph), link = items[[2]]$link ) x3_title <- glue::glue( article_title_template(), - title = items[[3]]$title, + title = + items[[3]]$title %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph), link = items[[3]]$link ) x1_content <- glue::glue( - article_content_template_2(), - content = items[[1]]$content + article_content_template(), + content = + items[[1]]$content %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph) ) x2_content <- glue::glue( - article_content_template_2(), - content = items[[2]]$content + article_content_template(), + content = + items[[2]]$content %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph) ) x3_content <- glue::glue( - article_content_template_2(), - content = items[[3]]$content + article_content_template(), + content = + items[[3]]$content %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph) ) block <- @@ -323,30 +344,44 @@ block_article_2 <- function(items) { ) } + paragraph <- "
" + x1_title <- glue::glue( article_title_template(), - title = items[[1]]$title, + title = + items[[1]]$title %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph), link = items[[1]]$link ) x2_title <- glue::glue( article_title_template(), - title = items[[2]]$title, + title = + items[[2]]$title %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph), link = items[[2]]$link ) x1_content <- glue::glue( - article_content_template_2(), - content = items[[1]]$content + article_content_template(), + content = + items[[1]]$content %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph) ) x2_content <- glue::glue( - article_content_template_2(), - content = items[[2]]$content + article_content_template(), + content = + items[[2]]$content %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph) ) block <- @@ -408,24 +443,36 @@ block_article_1 <- function(items) { link = items[[1]]$link) } + paragraph <- "
" + + x1_title <- + glue::glue( + article_title_template(), + title = + items[[1]]$title %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph), + link = items[[1]]$link + ) + x1_content <- glue::glue( - article_content_template_1(), - content = items[[1]]$content + article_content_template(), + content = + items[[1]]$content %>% + commonmark::markdown_html() %>% + tidy_gsub("
", paragraph) ) block <- glue::glue( "