6.1.2 Page Content
On this page:
6.1.2.1 Markdown
md
md*
6.1.2.2 HTML
html
html*
a
aside
audio
blockquote
br
dd
div
dt
em
h1
h2
h3
h4
h5
h6
img
label
li
ol
output
p
pre
script
section
span
strong
style
table
tbody
td
th
thead
tr
u
ul
video
6.1.2.3 Static Resources
define-static-resource
resource-uri
6.1.2 Page Content🔗

A study page is an X-expression representing a complete page of HTML content.

Any definition of a study step must be a function that produces an x-expression (or another study, but we won’t go into that here). But you should never need to create these values directly; rather, you’ll typically use helper functions like md and html that do this for you.

Examples:
> (define x (md "# Heading"))
> x

'(div ((class "container")) (div () (h1 "Heading")))

6.1.2.1 Markdown🔗

 (require conscript/markdown) package: conscript

The bindings provided by this module are also provided by conscript/base.

syntax

(md content-str ...)

 
  content-str : string?

syntax

(md* content-str ...)

 
  content-str : string?
Parses its contents as Markdown and produces an X-expression representing a complete page containing the resulting HTML content (md) or of a fragment of HTML suitable for use within another page (md*).

Examples:
> (md "# Heading")

'(div ((class "container")) (div () (h1 "Heading")))

> (md* "# Heading")

'(div () (h1 "Heading"))

6.1.2.2 HTML🔗

 (require conscript/html) package: conscript

The bindings in this module are also provided by conscript/base.

syntax

(html element ...)

 
  element : xexpr?

syntax

(html* element ...)

 
  element : xexpr?
Returns a complete page of HTML content (html), or a representation of a fragment of HTML suitable for use within another page (html*).

Examples:
> (html (div "content..."))

'(div ((class "container")) (div () (div () (p () "content..."))))

> (html* (div "content..."))

'(div () (div () (p () "content...")))

syntax

(a #:href href content ...)

syntax

(aside content ...)

syntax

(audio #:src src content ...)

syntax

(blockquote content ...)

syntax

(br)

syntax

(dd content ...)

syntax

(div content ...)

syntax

(dt content ...)

syntax

(em content ...)

syntax

(h1 content ...)

syntax

(h2 content ...)

syntax

(h3 content ...)

syntax

(h4 content ...)

syntax

(h5 content ...)

syntax

(h6 content ...)

syntax

(img #:alt alt #:src src content ...)

syntax

(label content ...)

syntax

(li content ...)

syntax

(ol content ...)

syntax

(output content ...)

syntax

(p content ...)

syntax

(pre content ...)

syntax

(script content ...)

syntax

(section content ...)

syntax

(span content ...)

syntax

(strong content ...)

syntax

(style content ...)

syntax

(table content ...)

syntax

(tbody content ...)

syntax

(td content ...)

syntax

(th content ...)

syntax

(thead content ...)

syntax

(tr content ...)

syntax

(u content ...)

syntax

(ul content ...)

syntax

(video #:src src content ...)

 
  content : xexpr?
Return representations (X-expressions) of HTML tags of the same names.

Any keyword arguments supplied are converted to attribute names/values in the resulting HTML representation. Keyword arguments specifically noted above are required for their respective forms.

Examples:
> (a #:href "/" "a link")

'(a ((href "/")) "a link")

> (a "/" "a link")

a: missing required keyword argument: #:href

> (a #:class "my-style" #:href "/" "styled link")

'(a ((class "my-style") (href "/")) "styled link")

6.1.2.3 Static Resources🔗

 (require conscript/resource) package: conscript

This module provides a way to access images and other static files that aren’t stored in the database. The files get uploaded automatically as long as they’re linked using define-static-resource. Or you can upload a zipped folder as long as the study is contained/provided from specifically named "study.rkt" inside that zip file.

syntax

(define-static-resource name path-string)

Registers the file at path-string as a static resource, and binds id to a #<resource> struct value for that file.

Use this in a "study.rkt" file and make path-string a path that is relative to that file. Then bundle the referenced files into a zip file before uploading to the Congame server. See How to add images for more details.

procedure

(resource-uri r [subr])  string?

  r : resource?
  subr : (or/c list? #f) = #f
Generates an absolute URL for the resource r on the current study server. The value r must be declared using define-static-resource.