Examplary
Start for free
Developer docs

Rich text formatting

The HTML and custom tags used in feedback, reasoning and question text: inline math, content references and page clippings.

Feedback, the AI's reasoning and question text are rich text. You'll find it in grading results from the REST API and webhooks, and it's what you send when you save feedback, create questions or return feedback from a custom question type.

Rich text is HTML, not Markdown. Besides a set of standard tags, Examplary uses three custom tags: <inline-math>, <content-reference> and <page-clipping>. Tags and attributes that aren't supported are stripped when saved.

Standard tags

TagUse it for
<strong>, <em>, <u>Bold, italic and underlined text
<mark>Highlighted text
<a href="…">Links
<code>, <pre>Inline code and blocks of programming code
<ul>, <ol>, <li>Lists
<blockquote>Longer quotes
<img src="…" alt="…">Images, shown as a block
<table>, <tr>, <th>, …Simple tables, with header rows where relevant
<p>, <br>Paragraphs and line breaks

Inline math

<inline-math> holds a LaTeX expression, which is rendered with MathLive:

Ohm's law says that <inline-math>R=\frac{V}{I}</inline-math>.
  • Don't add delimiters such as $, \( or \[, inside or around the tag.
  • Keep each expression on a single line. For several lines, use several tags.
  • It isn't a full LaTeX environment: environments like \begin{align} and custom macros aren't supported.

Escaping LaTeX in JSON

In JSON, a backslash starts an escape sequence, so every LaTeX backslash has to be written as \\:

{ "feedback": "Half of it is <inline-math>\\frac{1}{2}</inline-math>." }

With a single backslash the request still succeeds, but the LaTeX silently breaks: \frac becomes a form feed followed by rac, and \times a tab followed by imes. Most JSON libraries escape this for you; take care when you write JSON by hand or build it from strings.

Content references

In feedback and reasoning, <content-reference> points at part of the student's answer. Its quote attribute holds the exact text from the answer, and its content is what's shown:

You named the
<content-reference quote="Treaty of Paris">wrong treaty</content-reference>.

In Examplary, hovering over the reference highlights the quote in the answer. In your own interface, you can do the same, or just show the tag's content as plain text.

Page clippings

<page-clipping> shows a cut-out of a page of a PDF, such as a graph or table from the source materials:

<page-clipping
  url="https://example.com/chapter-3.pdf"
  page="2"
  x="100"
  y="250"
  width="800"
  height="300"
></page-clipping>
AttributeDescription
urlThe URL of the PDF.
pageThe page number, starting at 1.
x, yThe top-left corner of the cut-out, from 0 to 1000: (0, 0) is the page's top-left, (1000, 1000) its bottom-right.
width, heightThe size of the cut-out, on the same 0 to 1000 scale: width="1000" is the full page width.

Which fields support which tags

FieldStandard tagsinline-mathcontent-referencepage-clipping
Answer feedback✓✓✓
Criterion reasoning✓✓✓
Overall feedback✓✓
Question description✓✓✓
Question title✓✓
Answer options and hints✓✓

Example

A graded answer, as returned by the API. In JSON, the LaTeX backslashes are escaped:

Answer
{
  "gradingStatus": "auto-graded",
  "gradedBy": "system-ai",
  "pointsAwarded": 1,
  "feedback": "<p>Your formula is right, but check your arithmetic: <content-reference quote=\"12 / 4 = 2\">this step</content-reference> should give <inline-math>\\frac{12}{4}=3</inline-math>.</p>",
  "scoringCriteria": [
    {
      "id": "correct-formula",
      "pointsAwarded": 1,
      "confidenceScore": 95,
      "reasoning": "Uses <inline-math>R=\\frac{V}{I}</inline-math> correctly."
    },
    {
      "id": "correct-result",
      "pointsAwarded": 0,
      "confidenceScore": 90,
      "reasoning": "Divides wrongly in <content-reference quote=\"12 / 4 = 2\">the last step</content-reference>, so the result is off."
    }
  ]
}

See Reading the results for what each field means.