> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kralis.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Building Modules, Lessons, and Units

> Create, edit, remove, and reorder each level of an LMS course.

## Content hierarchy

```mermaid theme={null}
flowchart TD
    A[Course] --> B[Module]
    B --> C[Lesson]
    C --> D[Unit]
    D --> E[Content]
    D --> F[Optional assessment]
```

| Level | Use it for |
| - | - |
| Course | The complete learning experience |
| Module | A major topic or stage |
| Lesson | A focused part of a module |
| Unit | The page or activity a learner opens and completes |

## Build in order

1. Create the course.
2. Add a module to the course.
3. Add a lesson inside that module.
4. Add units inside the lesson.
5. Edit each unit's content.
6. Reorder each level to match the teaching sequence.
7. Preview the course.

## Unit content

Write for the learner who will see the unit without the editor around it. Use clear headings, short sections, useful examples, and an explicit completion goal.

## Rich documents, Markdown, and AI

Course notes and unit content have a rich-document field and an actively used Markdown compatibility field:

| Content | Rich document | Markdown compatibility field |
| - | - | - |
| Course notes | `notesDocument` | `notes` |
| Private course notes | `privateNotesDocument` | `privateNotes` |
| Unit content | `contentDocument` | `content` |

The rich document stores versioned Tiptap JSON and is preferred when displaying content. The Markdown field remains actively written for compatibility and as a fallback when a rich document has not yet been saved. Private course notes follow the same save and fallback flow as Course notes, but are staff-only: they are available in the editor and on the course detail page to non-students, and are omitted from student and enrollment views.

AI generates Markdown rather than Tiptap JSON. Full AI course/unit generation initially stores its generated text in the Markdown field. Opening that content in the rich editor converts it into a Tiptap document in the editor; that conversion is saved only when you save or update the course/unit. The standalone **Generate notes**, **Generate private notes**, **Generate content**, and **Improve with AI** actions show a preview. Applying the preview changes the editor but does not save the record; use the normal **Save** or **Update** action afterward.

Saving from the rich editor writes both representations: versioned JSON to the rich-document field and Markdown to the compatibility field. Updating an existing unit persists your edits even with AI mode enabled. Use **Regenerate unit** when you intend AI to replace the unit's content. Regeneration clears the previous rich document so the new Markdown is shown until the editor saves it as a new rich document.

## Attach CBT assessments

Use **Choose a test** in the editor to attach an existing eligible CBT test. Confirm the assessment matches the unit and course context. Editing the LMS connection does not rewrite the CBT questions.

## Reordering and deletion

Reordering changes navigation order. Deleting a parent can affect the content beneath it, so check child modules, lessons, or units and active enrollments before confirming.

<Warning>
  Do not delete published content merely to hide it temporarily. Use the available visibility or publication controls when the content may be needed again.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.