Hoppa till innehåll

Reading and challenges

This page shows the components used in reading lists and challenges — <ReadingList>, <ReadingListLegend>, <AiBlock>, and <Solution>.


<ReadingList> takes a comma-separated list of section numbers and renders them as color-coded chips. Use the same syntax as in the course literature: **x.x** for priority sections and ~~x.x~~ for sections that can be skipped.

All three states:

  • 3.2.1
  • 3.3
  • 3.6

A longer list covering all three states:

  • 3.1
  • 3.2
  • 3.2.1
  • 3.2.2
  • 3.2.3
  • 3.2.4
  • 3.2.5
  • 3.2.6
  • 3.3
  • 3.3.1
  • 3.3.2
  • 3.3.5
  • 3.4
  • 3.5
  • 3.6
  • 3.7
  • 3.8
  • 3.9

<ReadingListLegend> renders a fixed legend explaining the three chip colors — drop it above a page’s first <ReadingList> so students only need to see it once.

Färgförklaring för chipsen nedan:

  • Prioritera
  • Läs
  • Hoppa över

<AiBlock> shows a concrete example of how not to prompt (gray, struck through) and how you should prompt (normal text) when working with an AI assistant.

A more specific example from course week 1:


<Solution> hides its content behind a blurred overlay with a “Show solution” button. Without JavaScript, the content is shown directly. The “Suggested solution” heading is written in the MDX page itself, not inside the component.

> Math.trunc(843 / 24)
35
> 843 % 24
3

A solution mixing text and code:

> 'IT IS UPPERCASE'.replace('UPPERCASE', 'wrong').toLowerCase()
'it is wrong'

The replace() method creates a new string with the replacement applied. The subsequent call to toLowerCase() runs on that new string — not on the original.


Here’s how they look together, just like in a real challenge:

Create an expression that calculates the number of whole days that 843 hours corresponds to.

(your expression for the number of days) -> 35

Try the expression in the Node terminal.

> Math.trunc(843 / 24)
35
CCBY