dccMarkdown: Markdown component

Description Usage Arguments Value Examples

View source: R/dccMarkdown.R

Description

A component that renders Markdown text as specified by the GitHub Markdown spec. These component uses [react-markdown](https://rexxars.github.io/react-markdown/) under the hood.

Usage

1
2
3
dccMarkdown(children=NULL, id=NULL, className=NULL,
dangerously_allow_html=NULL, dedent=NULL,
highlight_config=NULL, loading_state=NULL, style=NULL)

Arguments

children

Character | list of characters. A markdown string (or array of strings) that adhreres to the CommonMark spec

id

Character. The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app.

className

Character. Class name of the container element

dangerously_allow_html

Logical. A boolean to control raw HTML escaping. Setting HTML from code is risky because it's easy to inadvertently expose your users to a cross-site scripting (XSS) (https://en.wikipedia.org/wiki/Cross-site_scripting) attack.

dedent

Logical. Remove matching leading whitespace from all lines. Lines that are empty, or contain *only* whitespace, are ignored. Both spaces and tab characters are removed, but only if they match; we will not convert tabs to spaces or vice versa.

highlight_config

Lists containing elements 'theme'. those elements have the following types: - theme (a value equal to: 'dark', 'light'; optional): color scheme; default 'light'. Config options for syntax highlighting.

loading_state

Lists containing elements 'is_loading', 'prop_name', 'component_name'. those elements have the following types: - is_loading (logical; optional): determines if the component is loading or not - prop_name (character; optional): holds which property is loading - component_name (character; optional): holds the name of the component that is loading. Object that holds the loading state object coming from dash-renderer

style

Named list. User-defined inline styles for the rendered Markdown

Value

named list of JSON elements corresponding to React.js properties and their values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if (interactive() && require(dash)) {
    library(dash)
    library(dashHtmlComponents)
    library(dashCoreComponents)

    app <- Dash$new()

    app$title("dccMarkdown Syntax Highlighting Demo")

    # dccMarkdown leverages Highlight.js, which allows
    # app developers to specify the language inline
    # and highlight its syntax properly:
    app$layout(
      htmlDiv(
        list(
          htmlDiv(htmlH2("Syntax markdown demo:")),
          dccMarkdown(children = "
          ```r
          library(dash)
          library(dashHtmlComponents)

          app <- Dash$new()
          app$layout(htmlDiv('Dash app code wrapped within an app'))
          app$run_server()
          ```")
        )
      )
    )

  app$run_server()
}

Example output



dashCoreComponents documentation built on July 1, 2020, 8:20 p.m.