UNPKG

3.86 kBMarkdownView Raw
1## Cells - Reactive Spreadsheet Cells
2
3Smartdown uses ordinary Markdown link syntax to specify a cell *label* and *body*, where the *label* is specified in the link label, and the *body* is specified in the link's URL. For example, the following declares an *output* cell that displays the value of the `FOO` variable:
4
5```markdown
6[The value of FOO is](:!FOO)
7```
8
9When a non-empty label is present, the cell will be formatted with its label on its own line. When no label is present, then the cell will be formatted inline.
10
11### Cells with labels get their own line
12
13- [What is your name?](:?NAME)
14- [Glad to meet you](:!NAME)
15- [What is your name again?](:?NAME)
16- [Really glad to meet you](:!NAME)
17- [Are you human?](:XHUMAN)
18- [Humanity](:!HUMAN)
19
20
21### Cells with no labels are inlined
22
23What is your name? [](:?NAME) So glad to meet you [](:!NAME). What is your name again? [](:?NAME) Really glad to meet you [](:!NAME).
24Are you human? [](:XHUMAN) Your Humanity is [](:!HUMAN).
25
26### Cell output filters
27
28The syntax:
29
30```markdown
31[](:!MyExpr|markdown)
32
33```
34
35will result in the value in variable `MyExpr` being formatted as Smartdown and then rendered as the output of the cell.
36
37For example, type Smartdown into the input cell below and see the resulting rendered Smartdown:
38
39[Type Markdown Here](:?MyMarkdown)
40[Rendered Markdown](:!MyMarkdown|markdown)
41
42
43### Numeric data
44
45By default, a cell is a string. An input cell may be annotated to indicate that the datatype is `number` and that conversions should occur upon input. The example below illustrates this by modifying and displaying the smartdown variables `alpha` and `beta`. This example also shows how the numeric range syntax can be used to create an input slider. This example also demonstrates various ways to label an input.
46
47**α** [](:?alpha|number) [](:-alpha/0/100/0.01)
48**β** [](:?beta|number) [](:-beta/0/100/0.01)
49
50[α](:?alpha|number) [](:-alpha/0/100/0.01)
51[β](:?beta|number) [](:-beta/0/100/0.01)
52
53[$\alpha$](:?alpha|number) [α](:-alpha/0/100/0.01)
54[$\beta$](:?beta|number) [β](:-beta/0/100/0.01)
55```
56
57### Navigation Links
58
59- [Go to SVG Card with Text Label](:@SVG)
60- [Go to P5JS Card with Image ![](https://upload.wikimedia.org/wikipedia/commons/1/12/Earth_within_celestial_sphere.gif)](:@P5JS)
61- [Go to Tweets with SVG Image ![](/media/lighthouse/pulse)](:@Tweets)
62
63### Calculations
64
65[Double Me](:=DNAME=NAME+NAME)
66
67[Double Name](:!DNAME)
68
69
70### External Data Query
71
72*The Smartdown code below is a work in progress and the syntax used is experimental and in flux.*
73
74One of the goals of Smartdown is to enable simple text files to express rich interactive experiences that involve live data. Ideally, web-based services would already exist to serve the data-hunger of Smartdown. In this example, we are exploring the use of [Wikidata](https://www.wikidata.org) as a data source.
75
76Limitations of the current tech include:
77
78- The [Falcor](https://netflix.github.io/falcor/) syntax is a hack and is not using the Falcor library.
79- The current example emphasizes the extraction of thumbnail images from Wikidata and does not display or utilize the full set of metadata returned.
80
81[WHAT do you want to look up?](:?WHAT)
82
83Examples:
84- Earth
85- Buddha
86- Uranium
87- Oregon
88- Abraham Lincoln
89- [Lookup `WHAT`](:=LOOKUP=/wikidata["`WHAT`"])
90- [Lookup `WHAT` images](:=LOOKUP=/wikidataThumbs["`WHAT`"])
91
92
93- [Albert Einstein|Marie Curie|Max Plank (Slash, Title/URL)](:=LOOKUP=/wikidata/Albert Einstein|Marie Curie|Max Plank)
94- [Albert Einstein|Marie Curie|Max Plank (Slash, Thumbnails)](:=LOOKUP=/wikidataThumbs/Albert Einstein|Marie Curie|Max Plank)
95
96- [Albert Einstein (Falcor, Title/URL)](:=LOOKUP=/wikidata["Albert Einstein"])
97- [Albert Einstein (Falcor, Thumbnails)](:=LOOKUP=/wikidataThumbs["Albert Einstein"])
98
99- [Lookup result](:!LOOKUP)
100
101---
102
103[](:!LOOKUP)
104
105---
106
107[Back to Home](:@Home)
108
109
\No newline at end of file