Skip to content

Commit dffe2ad

Browse files
committed
Update R examples in dashHtmlComponents (plotly#153)
1 parent 3de5c78 commit dffe2ad

File tree

4 files changed

+248
-44
lines changed

4 files changed

+248
-44
lines changed

packages/dash-html-components/dash-info.yaml

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ r_examples:
7171
7272
app$layout(
7373
htmlDiv(list(
74-
htmlAddress(children='5555 Avenue de Gasp\U{00E9}, Montr\U{00E9}al QC H2T 2A3')
74+
htmlAddress(children='5555 Avenue de Gaspe, Montreal QC H2T 2A3')
7575
)
7676
)
7777
)
@@ -133,7 +133,7 @@ r_examples:
133133
htmlP('Dash is a user interface library for creating analytical web applications.\n
134134
Those who use R for data analysis, data exploration, visualization,\n
135135
modelling, instrument control, and reporting will find immediate use for Dash for R.'),
136-
htmlAside('Plotly is a technical computing company with offices in Montr\U{00E9}al, Canada and Cambridge, Massachusetts.')
136+
htmlAside('Plotly is a technical computing company with offices in Montreal, Canada and Cambridge, Massachusetts.')
137137
)
138138
)
139139
)
@@ -156,7 +156,7 @@ r_examples:
156156
htmlP('Dash is a user interface library for creating analytical web applications.\n
157157
Those who use R for data analysis, data exploration, visualization,\n
158158
modelling, instrument control, and reporting will find immediate use for Dash for R.'),
159-
htmlAside('Plotly is a technical computing company with offices in Montr\U{00E9}al, Canada and Cambridge, Massachusetts.')
159+
htmlAside('Plotly is a technical computing company with offices in Montreal, Canada and Cambridge, Massachusetts.')
160160
)
161161
)
162162
)
@@ -215,7 +215,7 @@ r_examples:
215215
)
216216
)
217217
218-
app$run_server()
218+
app$run_server()
219219
- name: htmlBasefont
220220
dontrun: TRUE
221221
code: |
@@ -562,12 +562,12 @@ r_examples:
562562
- name: htmlCommand
563563
dontrun: TRUE
564564
code: |
565-
# This component is deprecated and its use is no longer recommended.
565+
# This component is deprecated and its use is no longer recommended.
566566
- name: htmlContent
567567
dontrun: TRUE
568568
code: |
569-
# This feature is obsolete and no longer supported. It is recommended
570-
# that you use the htmlSlot component instead.
569+
# This feature is obsolete and no longer supported. It is recommended
570+
# that you use the htmlSlot component instead.
571571
- name: htmlData
572572
dontrun: TRUE
573573
code: |
@@ -586,10 +586,10 @@ r_examples:
586586
)
587587
)
588588
)
589-
589+
590590
# Include the following in a seperate CSS file in an
591591
# `assets` directory in the root of your app.
592-
#
592+
#
593593
# data:hover::after {
594594
# content: ' (ID ' attr(value) ')';
595595
# font-size: .7em;
@@ -941,7 +941,7 @@ r_examples:
941941
)
942942
)
943943
944-
app$run_server()
944+
app$run_server()
945945
- name: htmlH1
946946
dontrun: TRUE
947947
code: |
@@ -1172,7 +1172,7 @@ r_examples:
11721172
- name: htmlIsindex
11731173
dontrun: TRUE
11741174
code: |
1175-
# This component is deprecated and its use is no longer recommended.
1175+
# This component is deprecated and its use is no longer recommended.
11761176
- name: htmlKbd
11771177
dontrun: TRUE
11781178
code: |
@@ -1392,7 +1392,7 @@ r_examples:
13921392
htmlDiv(list(
13931393
htmlP(list(
13941394
htmlMark("Plotly"),
1395-
'develops online data analytics and visualization tools."
1395+
" develops online data analytics and visualization tools."
13961396
))
13971397
))
13981398
)
@@ -1490,7 +1490,7 @@ r_examples:
14901490
- name: htmlNextid
14911491
dontrun: TRUE
14921492
code: |
1493-
# This component is deprecated and its use is no longer recommended.
1493+
# This component is deprecated and its use is no longer recommended.
14941494
# The <nextid> tag has been obsolete since HTML Version 3.2.
14951495
- name: htmlNobr
14961496
dontrun: TRUE
@@ -1527,7 +1527,7 @@ r_examples:
15271527
code: |
15281528
# Note that htmlObjectEl generates the <object> HTML element;
15291529
# for more information, please visit the link in this
1530-
# component's description.
1530+
# component's description.
15311531
library(dash)
15321532
library(dashHtmlComponents)
15331533
@@ -1639,7 +1639,7 @@ r_examples:
16391639
htmlDiv(list(
16401640
htmlP("The <param> element is used to specify the parameters that apply to
16411641
plugin-powered content embedded with an <object> element.
1642-
Read more: https://html.com/tags/param/#ixzz5vBNn4V00"),
1642+
Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/param"),
16431643
htmlObjectEl(
16441644
#data = "link-to-data-file"
16451645
htmlParam(name = "controller", value = TRUE)
@@ -1756,11 +1756,18 @@ r_examples:
17561756
17571757
app$layout(
17581758
htmlDiv(list(
1759-
htmlRuby(
1760-
htmlRb(
1761-
"\U{65e5}"
1762-
)
1763-
)
1759+
htmlRuby(list(
1760+
"\U{6f22}",
1761+
htmlRp("("),
1762+
htmlRt("kan"),
1763+
htmlRp(")")
1764+
)),
1765+
htmlRuby(list(
1766+
"\U{5b57}",
1767+
htmlRp("("),
1768+
htmlRt("ji"),
1769+
htmlRp(")")
1770+
))
17641771
))
17651772
)
17661773
@@ -1770,22 +1777,27 @@ r_examples:
17701777
code: |
17711778
library(dash)
17721779
library(dashHtmlComponents)
1773-
library(dashCoreComponents)
17741780
17751781
app <- Dash$new()
17761782
17771783
app$layout(
17781784
htmlDiv(list(
17791785
htmlRuby(list(
1780-
"\U{6f22}",
1781-
htmlRp("("),
1782-
htmlRt("kan"),
1783-
htmlRp(")")
1784-
))
1785-
))
1786-
)
1787-
1788-
app$run_server()
1786+
"\U{6f22}",
1787+
htmlRp("("),
1788+
htmlRt("kan"),
1789+
htmlRp(")")
1790+
)),
1791+
htmlRuby(list(
1792+
"\U{5b57}",
1793+
htmlRp("("),
1794+
htmlRt("ji"),
1795+
htmlRp(")")
1796+
))
1797+
))
1798+
)
1799+
1800+
app$run_server()
17891801
- name: htmlRt
17901802
dontrun: TRUE
17911803
code: |
@@ -1796,12 +1808,20 @@ r_examples:
17961808
17971809
app$layout(
17981810
htmlDiv(list(
1811+
htmlRuby(list(
1812+
"\U{6f22}",
1813+
htmlRp("("),
1814+
htmlRt("kan"),
1815+
htmlRp(")")
1816+
)),
17991817
htmlRuby(list(
18001818
"\U{5b57}",
1801-
htmlRt("ji")
1802-
))
1803-
))
1804-
)
1819+
htmlRp("("),
1820+
htmlRt("ji"),
1821+
htmlRp(")")
1822+
))
1823+
))
1824+
)
18051825
18061826
app$run_server()
18071827
- name: htmlRtc
@@ -1848,7 +1868,8 @@ r_examples:
18481868
app$layout(
18491869
htmlDiv(list(
18501870
htmlS("htmlS generates strikethrough text"),
1851-
htmlP("htmlB generates bold text")
1871+
htmlP(),
1872+
htmlB("htmlB generates bold text")
18521873
))
18531874
)
18541875
@@ -1925,7 +1946,7 @@ r_examples:
19251946
# with caution; it is now considered an obsolete element
19261947
# within the Web Components suite. It is retained here
19271948
# solely for backwards compatibility reasons.
1928-
#
1949+
#
19291950
# For more information, please see the MDN link above.
19301951
- name: htmlSlot
19311952
dontrun: TRUE
@@ -2108,7 +2129,7 @@ r_examples:
21082129
21092130
app$layout(
21102131
htmlDiv(list(
2111-
"You can create an Table with HtmlTable",
2132+
"You can create a table with htmlTable:",
21122133
htmlBr(),
21132134
htmlTable(
21142135
list(
@@ -2366,7 +2387,7 @@ r_examples:
23662387
list(
23672388
"It might be useful to wrap dates like ",
23682389
htmlTime(dateTime = "2019-07-29", children = "July 29th"),
2369-
'in an htmlTime to make your datetimes machine readable"
2390+
" in an htmlTime to make your datetime strings machine-readable."
23702391
)
23712392
)
23722393
)
@@ -2380,8 +2401,8 @@ r_examples:
23802401
# This component's effects will be overridden by the index
23812402
# template in Dash for R. We suggest using Dash's API to
23822403
# set the page title instead:
2383-
#
2384-
# app <- Dash$new(name = 'My page title')
2404+
#
2405+
# app$title('My page title')
23852406
- name: htmlTr
23862407
dontrun: TRUE
23872408
code: |

packages/dash-html-components/vignettes/dash-html-components.Rmd

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Dash HTML Components"
3-
output: rmarkdown::html_vignette
3+
output:
4+
html_document:
5+
highlight: tango
46
vignette: >
57
%\VignetteIndexEntry{Dash HTML Components}
68
%\VignetteEngine{knitr::knitr}
@@ -30,12 +32,12 @@ htmlDiv(list(
3032

3133
which gets converted (behind the scenes) into the following HTML in your web application:
3234

33-
```html
35+
```
3436
<div>
3537
<h1>Hello Dash</h1>
3638
<div>
3739
<p>Dash converts Python classes into HTML</p>
38-
<p>This conversion happens behind the scenes by Dash's JavaScript front-end</p>
40+
<p>This conversion happens behind the scenes by the JavaScript front-end</p>
3941
</div>
4042
</div>
4143
```
@@ -44,10 +46,12 @@ If you're not comfortable with HTML, don't worry! You can get 95% of the way the
4446

4547
```r
4648
library(dashHtmlComponents)
49+
library(dashCoreComponents)
4750
library(dash)
4851
dccMarkdown('''
4952
#### Dash and Markdown
5053
Dash supports [Markdown](https://daringfireball.net/projects/markdown/).
54+
5155
Markdown is a simple way to write and format text.
5256
It includes a syntax for things like **bold text** and *italics*,
5357
[links](https://daringfireball.net/projects/markdown/), inline `code` snippets, lists,
@@ -82,7 +86,7 @@ htmlDiv(list(
8286

8387
That Dash code will render this HTML markup:
8488

85-
```html
89+
```
8690
<div style="margin-bottom: 50px; margin-top: 25px;">
8791
8892
<div style="color: blue; font-size: 14px">

0 commit comments

Comments
 (0)