📚 Complete Fragment Types Showcase
This document demonstrates all available fragment types in the Pedagogical Message (PM) system. Each fragment type is shown with its markdown syntax and rendered output.
📝 Text Fragments
Headings (h1_, h2_, h3_, h4_)
This is an H1 Heading
This is an H2 Heading
This is an H3 Heading
This is an H4 Heading
Paragraphs (p_)
This is a regular paragraph. It can contain bold text, italic text, and even inline code. Paragraphs are the most basic fragment type and are created automatically from regular text.
Here's another paragraph with a link to example.com and some mathematical notation like $x^2 + y^2 = z^2$.
Blockquotes (q_)
This is a blockquote fragment. It's perfect for highlighting important information or quotes.
Lead Paragraphs
This paragraph has a special lead class that makes it stand out as an introduction or summary.
Styled Paragraphs
This paragraph has a secondary background color.
This paragraph has a white background and no margin.
📋 List Fragments
Unordered Lists (ul_)
- First item
- Second item
- Nested item 2.1
- Nested item 2.2
- Third item
Ordered Lists (ol_)
- First step
- Second step
- Sub-step 2.1
- Sub-step 2.2
- Third step
Line-by-line (lbl_) — progressive reveal
A special list that reveals items one-by-one with buttons. You can pre-reveal the first N items using an attribute.
Example A (default: start hidden):
- Première ligne
- Deuxième ligne
- Troisième ligne
Example B (reveal first 1):
- Ligne A
- Ligne B
- Ligne C
Example C (reveal first 2 using reveal-first):
- Étape 1
- Étape 2
- Étape 3
🎯 Interactive Fragments
Radio Buttons (radio_)
Which programming language are we learning?
Multiple Correct Answers
Which of these are prime numbers?
Math Input (maths_)
Interactive Graph (graph_)
📊 Data & Visual Fragments
Tables (table_)
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Data 1 | Data 2 | Data 3 |
| Value A | Value B | Value C |
| Item X | Item Y | Item Z |
Complex Table
| Student | Math | Physics | Chemistry | Average |
|---|---|---|---|---|
| Alice | 95 | 88 | 92 | 91.7 |
| Bob | 87 | 91 | 85 | 87.7 |
| Charlie | 92 | 95 | 90 | 92.3 |
🖼️ Media Fragments
Images (image_)
SVG Graphics (svg_)
Inline SVG with Custom Classes
💻 Code Fragments
Code Blocks (code_)
# Python code example
def calculate_area(width, height):
"""Calculate the area of a rectangle."""
return width * height
# Using the function
area = calculate_area(10, 5)
print(f"The area is: {area}")
// JavaScript example
const greet = (name) => {
return `Hello, ${name}!`;
};
console.log(greet("World"));
Interactive Code (codex_)
Legacy syntax:
codexPCAVersion: 1
script_path: "pyly/premiers-pas-affichages-strings.py"
New syntax (preferred):
📈 Mathematical Fragments
Table of Variations (tabvar_)
class: table-variations
x_values: ["-∞", -2, 0, 2, "+∞"]
f_variations: ["↗", "max", "↘", "min", "↗"]
f_values: ["-∞", 4, 0, -4, "+∞"]
function: "f(x) = x³ - 3x"
🎨 Special Fragments
Horizontal Rule / Divider (hr_)
Content before the divider.
Content after the divider.
Layout directive (columns)
This paragraph will appear next to the SVG on small screens and up.
Table of Contents (toc_)
The [TOC] marker at the beginning of this document generates an automatic table of contents based on all headings.
🔧 Fragment Attributes
Custom CSS Classes
You can add custom CSS classes to most fragments using the attribute syntax:
This paragraph has multiple custom classes applied.
Nested Content
This blockquote contains bold text, italic text, and even math: $e^{i\pi} + 1 = 0$
📋 Combining Fragments
Fragments can work together to create rich educational content:
Example Problem
Calculate the area of a rectangle with width 8 and height 5.
width = 8
height = 5
area = width * height
print(f"Area = {area}")
What is the result?
Solution: The area of a rectangle is width × height = 8 × 5 = 40
📝 Notes
- All fragments are automatically validated when the PM is built
- Fragment types are defined in the
FTypeenum - Each fragment can have associated data and CSS classes
- Interactive fragments track user responses and can provide feedback
- The system supports both HTML and markdown input formats
This showcase demonstrates the flexibility and power of the PM fragment system for creating rich, interactive educational content.