NO PRODUCT SETTINGS FOUND FOR:
documentation

Gentle remainder that the product name comes from the `origin` first subfolder (after `/pms` ).

Fragment Architecture Guide

HTML Structure Pattern

Consistent Two-Level Architecture

All fragments follow this pattern:

<div class="fragment-wrapper {custom-classes}" data-f_type="{type}">
  <{element} class="fragment {element-specific-classes}" data-f_type="{type}">
    {content}
  </{element}>
</div>

Benefits of This Approach

    1. Dual-level data attributes: Both wrapper and inner element have data-f_type
    2. Enables flexible CSS targeting: .fragment[data-f_type="h1_"] or .fragment-wrapper[data-f_type="h1_"]
    3. Better JavaScript selectors for different use cases
    4. Clearer debugging in browser DevTools

    5. Wrapper for layout control:

    6. Handles spacing between fragments
    7. Applies custom classes from markdown
    8. Controls max-width and alignment

    9. Inner element for content:

    10. Has semantic HTML element (h1, p, blockquote, etc.)
    11. Carries the fragment class for consistent styling
    12. Contains the actual content

Fragment Types and Their Elements

Fragment TypeInner ElementNotes
h1_<h1>Direct heading element
h2_<h2>Direct heading element
h3_<h3>Direct heading element
h4_<h4>Direct heading element
p_<p>Paragraph element
q_<blockquote>Quote element
hr_<hr>Horizontal rule
ul_<ul>Unordered list
ol_<ol>Ordered list
table_<div>Container for table
image_<div>Container for img
svg_<div>Container for SVG
code_<div>Container for pre/code
codex_<div>Container for CodeMirror
radio_<div>Interactive radio container
maths_<div>Math input container
graph_<div>Graph visualization
tabvar_<div>Variation table
toc_<nav>Table of contents

CSS Targeting Examples

/* Target all fragments of a specific type */
.fragment[data-f_type="h1_"] {
  /* Styles for h1 content */
}

/* Target wrapper for spacing */
.fragment-wrapper[data-f_type="p_"] + .fragment-wrapper[data-f_type="h2_"] {
  margin-top: 2rem;
}

/* Target by both class and type */
.fragment.lead[data-f_type="p_"] {
  font-size: 1.25rem;
}

/* Custom class on wrapper */
.fragment-wrapper.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

JavaScript Selectors

// Select all headings
const headings = document.querySelectorAll('.fragment[data-f_type^="h"]');

// Select specific fragment type
const radios = document.querySelectorAll('.fragment[data-f_type="radio_"]');

// Select wrapper for layout manipulation
const wrappers = document.querySelectorAll('.fragment-wrapper[data-f_type="image_"]');

// Query within a specific fragment
const radioButtons = fragment.querySelectorAll('button[data-flag]');

Special Cases

Radio Fragments

Radio fragments have additional nested structure for feedback:

&lt;div class="fragment-wrapper" data-f_type="radio_"&gt;
  &lt;div class="fragment" data-f_type="radio_"&gt;
    &lt;!-- Radio buttons --&gt;
    &lt;div id="radio-feedback-{index}"&gt;...&lt;/div&gt;
    &lt;div id="radio-explanation-{index}"&gt;...&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

Tables

Tables maintain their semantic structure:

&lt;div class="fragment-wrapper" data-f_type="table_"&gt;
  &lt;div class="fragment overflow-x-auto" data-f_type="table_"&gt;
    &lt;table class="fragment-table"&gt;
      &lt;!-- Table content --&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/div&gt;

Migration Notes

When updating existing code: 1. Remove unnecessary intermediary divs 2. Apply fragment class directly to semantic elements 3. Add data-f_type to both wrapper and fragment 4. Ensure custom classes go on the wrapper

Benefits Summary

    1. Consistency: All fragments follow the same pattern
    2. Flexibility: Dual targeting for CSS and JS
    3. Semantic: Uses appropriate HTML elements
    4. Maintainable: Clear separation of concerns
    5. Debuggable: Easy to identify in DevTools
    6. Extensible: Easy to add new fragment types
Maths.pm ne collecte aucune donnée.
Aucun cookie collecté, aucune ligne de log d'écrite, pas l'ombre d'une base de données distante - nihil omnino.
Toutes les exécutions de code se font localement. Nous expliquons notre démarche sur cette page.

Limites de confidentialité (impact de l'hébergeur)
Aspects technologiques
Chez Pointcarre.app, nous nous engageons en faveur des communs numériques.

Ressources pédagogiques
Logiciels Libres & Infrastructure 🇫🇷

Codes sources
Logo licence AGPLv3
Contenus
Logo licence Creative Commons

Maths.pm, par

pointcarre.app