@fsegurai/marked-extended-accordion 18.0.0 → 18.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,10 @@
11
11
  <img src="https://img.shields.io/npm/v/@fsegurai/marked-extended-accordion.svg"
12
12
  alt="Latest Release">
13
13
  </a>
14
+ <a href="https://www.npmjs.com/package/@fsegurai/marked-extended-accordion">
15
+ <img src="https://img.shields.io/npm/dt/@fsegurai/marked-extended-accordion"
16
+ alt="Total npm downloads">
17
+ </a>
14
18
  <br>
15
19
  <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fsegurai/marked-extensions">
16
20
  <img alt="Dependency status for repo" src="https://img.shields.io/librariesio/github/fsegurai/marked-extensions">
@@ -255,6 +259,49 @@ Content with slower transition
255
259
  `````
256
260
  ```
257
261
 
262
+ ### Sanitizer-safe markup and the browser runtime (18.1.0)
263
+
264
+ By default the HTML survives strict sanitizers such as Angular's `SecurityContext.HTML`, which removes `id`, `name`,
265
+ `style`, `data-*` and `<svg>`. Those values move into class tokens (`mx-accordion-<key>-<value>`):
266
+
267
+ | 18.0 markup | 18.1.0 default |
268
+ | --- | --- |
269
+ | `id="accordion-x1y2z3"` | `mx-accordion-id-accordion-x1y2z3` |
270
+ | `name="faq"` (exclusive group) | `mx-accordion-group-faq` |
271
+ | `style="--…-animation-duration: 0.5s; …"` | `mx-accordion-duration-0_2e5s`, `mx-accordion-easing-…` (only when they differ from the defaults) |
272
+ | `data-section="intro"` | `mx-accordion-dataSection-intro` |
273
+ | variant `<svg>` icon | `<span class="mx-accordion-icon mx-accordion-icon-note">`, drawn by `accordion.css` |
274
+
275
+ `<details>`, `<summary>` and `open` survive sanitizing, so expanding and collapsing works without JavaScript. The rest is
276
+ done by a scoped runtime that you attach after the HTML is in the DOM:
277
+
278
+ ```javascript
279
+ import markedExtendedAccordion, { attachAccordion } from '@fsegurai/marked-extended-accordion';
280
+
281
+ marked.use(markedExtendedAccordion());
282
+ container.innerHTML = marked.parse(markdown);
283
+
284
+ // { className } if you changed the extension's className; allowedDataAttributes for custom data-* values
285
+ const dispose = attachAccordion(container, { allowedDataAttributes: ['data-section'] });
286
+ // later: dispose();
287
+ ```
288
+
289
+ - Applies the per-block `duration`/`easing` CSS variables and restores the `data-*` attributes listed in
290
+ `allowedDataAttributes` (case-insensitive, default `[]`). Class tokens can be written by hand in Markdown HTML, so
291
+ other `mx-accordion-data*` tokens are never restored: content cannot forge attributes such as `data-line`.
292
+ - Exclusive groups: opening an accordion closes the other open accordions of its group inside `container`.
293
+ - `#id` links whose target lost its `id` open and scroll to the accordion carrying that id token.
294
+ - Dispatches a bubbling `marked-extended:accordion:toggle` event with `detail: { id, open, group }`.
295
+ - Listeners live on `container` only; attaching twice is a no-op; the first `dispose()` removes everything.
296
+ - Replacing the content of `container` keeps groups, links and events working (they are delegated). The CSS variables
297
+ and `data-*` attributes are per element: call `attachAccordion.refresh(container)` after a re-render, or attach with
298
+ `attachAccordion(container, { observe: true })` (a `MutationObserver` on `container` only, disconnected by dispose).
299
+
300
+ Pass `unsafeHtml: true` to keep the 18.0 markup (`id`, `name`, `style`, `data-*`, inline `<svg>`) when you do not
301
+ sanitize the HTML. Custom templates can still use `{accordionId}`, `{nameAttr}`, `{dataAttrs}` and `{styleAttr}`
302
+ (strict sanitizers remove what they produce), and the new `{tokenClasses}` placeholder.
303
+
304
+
258
305
  ### Importing Styles
259
306
 
260
307
  Starting from version 17.0.0, this extension **does not automatically inject styles**. You must import the CSS or SCSS
@@ -354,7 +401,7 @@ Complete example for projects without build tools:
354
401
  <title>Marked Extended Accordion Example</title>
355
402
 
356
403
  <!-- Import Marked.js from CDN -->
357
- <script src="https://cdn.jsdelivr.net/npm/marked@17/lib/marked.umd.js"></script>
404
+ <script src="https://cdn.jsdelivr.net/npm/marked@18/lib/marked.umd.js"></script>
358
405
 
359
406
  <!-- Import Accordion Extension from CDN -->
360
407
  <script src="https://cdn.jsdelivr.net/npm/@fsegurai/marked-extended-accordion@latest/dist/index.umd.js"></script>
@@ -410,20 +457,20 @@ The extension generates semantic HTML using native `<details>` and `<summary>` e
410
457
 
411
458
  ```html
412
459
 
413
- <details id="accordion-{hash}" class="marked-extended-accordion" open name="faq"
414
- style="--marked-extended-accordion-animation-duration: 0.3s; --marked-extended-accordion-transition-timing: ease-in-out;">
415
- <summary class="marked-extended-accordion-header">
416
- <span class="marked-extended-accordion-icon" aria-hidden="true">➤</span>
417
- <h3 class="marked-extended-accordion-title">Your Title</h3>
460
+ <details id="accordion-{hash}" class="mx-accordion" open name="faq"
461
+ style="--mx-accordion-animation-duration: 0.3s; --mx-accordion-transition-timing: ease-in-out;">
462
+ <summary class="mx-accordion-header">
463
+ <span class="mx-accordion-icon" aria-hidden="true">➤</span>
464
+ <h3 class="mx-accordion-title">Your Title</h3>
418
465
  </summary>
419
- <div class="marked-extended-accordion-content">
466
+ <div class="mx-accordion-content">
420
467
  <!-- rendered markdown content -->
421
468
  </div>
422
469
  </details>
423
470
  ```
424
471
 
425
472
  (The `name` attribute and icon span only appear when `group`/`icon`/`variant` are set. A `variant` adds a
426
- `marked-extended-accordion-{variant}` class, `class` appends extra classes, and `data-*` keys become `data-*`
473
+ `mx-accordion-{variant}` class, `class` appends extra classes, and `data-*` keys become `data-*`
427
474
  attributes. With `iconPosition: after` the icon span moves after the heading.)
428
475
 
429
476
  **Benefits of using `<details>`:**
@@ -437,11 +484,11 @@ attributes. With `iconPosition: after` the icon span moves after the heading.)
437
484
 
438
485
  | Class | Element | Purpose |
439
486
  |--------------------------------------|-----------|----------------------------------|
440
- | `.marked-extended-accordion` | `details` | Main container element |
441
- | `.marked-extended-accordion-header` | `summary` | Clickable header/trigger element |
442
- | `.marked-extended-accordion-title` | `h1-h6` | Title text element |
443
- | `.marked-extended-accordion-icon` | `span` | Optional icon before title |
444
- | `.marked-extended-accordion-content` | `div` | Content wrapper |
487
+ | `.mx-accordion` | `details` | Main container element |
488
+ | `.mx-accordion-header` | `summary` | Clickable header/trigger element |
489
+ | `.mx-accordion-title` | `h1-h6` | Title text element |
490
+ | `.mx-accordion-icon` | `span` | Optional icon before title |
491
+ | `.mx-accordion-content` | `div` | Content wrapper |
445
492
 
446
493
  **Styling Targets:**
447
494
 
@@ -470,7 +517,7 @@ Create your own styles targeting the classes:
470
517
 
471
518
  ```css
472
519
  /* Base accordion styling */
473
- .marked-extended-accordion {
520
+ .mx-accordion {
474
521
  border: 1px solid #e0e0e0;
475
522
  border-radius: 8px;
476
523
  margin: 1rem 0;
@@ -479,7 +526,7 @@ Create your own styles targeting the classes:
479
526
  }
480
527
 
481
528
  /* Header (summary) styling */
482
- .marked-extended-accordion-header {
529
+ .mx-accordion-header {
483
530
  padding: 1rem;
484
531
  background: #f5f5f5;
485
532
  cursor: pointer;
@@ -488,16 +535,16 @@ Create your own styles targeting the classes:
488
535
  }
489
536
 
490
537
  /* Remove default disclosure triangle in WebKit browsers */
491
- .marked-extended-accordion-header::-webkit-details-marker {
538
+ .mx-accordion-header::-webkit-details-marker {
492
539
  display: none;
493
540
  }
494
541
 
495
- .marked-extended-accordion-header:hover {
542
+ .mx-accordion-header:hover {
496
543
  background: #ebebeb;
497
544
  }
498
545
 
499
546
  /* Title styling */
500
- .marked-extended-accordion-title {
547
+ .mx-accordion-title {
501
548
  margin: 0;
502
549
  font-size: 1.1rem;
503
550
  font-weight: 600;
@@ -506,7 +553,7 @@ Create your own styles targeting the classes:
506
553
  }
507
554
 
508
555
  /* Add custom icon using pseudo-element */
509
- .marked-extended-accordion-header::before {
556
+ .mx-accordion-header::before {
510
557
  content: '▶';
511
558
  display: inline-block;
512
559
  margin-right: 0.5rem;
@@ -515,12 +562,12 @@ Create your own styles targeting the classes:
515
562
  }
516
563
 
517
564
  /* Rotate icon when expanded */
518
- .marked-extended-accordion[open] .marked-extended-accordion-header::before {
565
+ .mx-accordion[open] .mx-accordion-header::before {
519
566
  transform: rotate(90deg);
520
567
  }
521
568
 
522
569
  /* Content styling */
523
- .marked-extended-accordion-content {
570
+ .mx-accordion-content {
524
571
  padding: 1rem;
525
572
  background: #fff;
526
573
  }
@@ -537,7 +584,7 @@ Create your own styles targeting the classes:
537
584
  }
538
585
  }
539
586
 
540
- .marked-extended-accordion[open] .marked-extended-accordion-content {
587
+ .mx-accordion[open] .mx-accordion-content {
541
588
  animation: accordion-open 0.3s ease;
542
589
  }
543
590
  ```
@@ -557,24 +604,24 @@ Use CSS variables for easy theming:
557
604
  }
558
605
 
559
606
  /* Apply variables to classes */
560
- .marked-extended-accordion {
607
+ .mx-accordion {
561
608
  border: 1px solid var(--accordion-border);
562
609
  background: var(--accordion-bg);
563
610
  }
564
611
 
565
- .marked-extended-accordion-header {
612
+ .mx-accordion-header {
566
613
  background: var(--accordion-header-bg);
567
614
  }
568
615
 
569
- .marked-extended-accordion-header:hover {
616
+ .mx-accordion-header:hover {
570
617
  background: var(--accordion-header-hover);
571
618
  }
572
619
 
573
- .marked-extended-accordion-title {
620
+ .mx-accordion-title {
574
621
  color: var(--accordion-text);
575
622
  }
576
623
 
577
- .marked-extended-accordion-icon {
624
+ .mx-accordion-icon {
578
625
  color: var(--accordion-icon);
579
626
  }
580
627
  ```
@@ -585,32 +632,32 @@ Add dark theme overrides:
585
632
 
586
633
  ```css
587
634
  /* Light theme (default) */
588
- body.light .marked-extended-accordion {
635
+ body.light .mx-accordion {
589
636
  border-color: #e0e0e0;
590
637
  background: #ffffff;
591
638
  }
592
639
 
593
- body.light .marked-extended-accordion-header {
640
+ body.light .mx-accordion-header {
594
641
  background: #f5f5f5;
595
642
  color: #333;
596
643
  }
597
644
 
598
645
  /* Dark theme */
599
- body.dark .marked-extended-accordion {
646
+ body.dark .mx-accordion {
600
647
  border-color: #444c56;
601
648
  background: #22272e;
602
649
  }
603
650
 
604
- body.dark .marked-extended-accordion-header {
651
+ body.dark .mx-accordion-header {
605
652
  background: #2d333b;
606
653
  color: #d1d5da;
607
654
  }
608
655
 
609
- body.dark .marked-extended-accordion-header:hover {
656
+ body.dark .mx-accordion-header:hover {
610
657
  background: #343b45;
611
658
  }
612
659
 
613
- body.dark .marked-extended-accordion-content {
660
+ body.dark .mx-accordion-content {
614
661
  color: #d1d5da;
615
662
  }
616
663
  ```
@@ -628,36 +675,36 @@ Enhance keyboard navigation styling:
628
675
 
629
676
  ```css
630
677
  /* Focus styles for keyboard navigation */
631
- .marked-extended-accordion-header:focus {
678
+ .mx-accordion-header:focus {
632
679
  outline: 2px solid #0066cc;
633
680
  outline-offset: 2px;
634
681
  }
635
682
 
636
- .marked-extended-accordion-header:focus-visible {
683
+ .mx-accordion-header:focus-visible {
637
684
  outline: 2px solid #0066cc;
638
685
  outline-offset: 2px;
639
686
  }
640
687
 
641
688
  /* Remove outline for mouse users (but keep for keyboard) */
642
- .marked-extended-accordion-header:focus:not(:focus-visible) {
689
+ .mx-accordion-header:focus:not(:focus-visible) {
643
690
  outline: none;
644
691
  }
645
692
 
646
693
  /* High contrast mode support */
647
694
  @media (prefers-contrast: high) {
648
- .marked-extended-accordion {
695
+ .mx-accordion {
649
696
  border-width: 2px;
650
697
  }
651
698
 
652
- .marked-extended-accordion-header {
699
+ .mx-accordion-header {
653
700
  border: 2px solid currentColor;
654
701
  }
655
702
  }
656
703
 
657
704
  /* Reduced motion support */
658
705
  @media (prefers-reduced-motion: reduce) {
659
- .marked-extended-accordion-header::before,
660
- .marked-extended-accordion-content {
706
+ .mx-accordion-header::before,
707
+ .mx-accordion-content {
661
708
  transition: none;
662
709
  animation: none;
663
710
  }
@@ -667,36 +714,93 @@ Enhance keyboard navigation styling:
667
714
  #### Example: Minimal Modern Style
668
715
 
669
716
  ```css
670
- .marked-extended-accordion {
717
+ .mx-accordion {
671
718
  border: none;
672
719
  border-left: 3px solid #0066cc;
673
720
  margin: 1.5rem 0;
674
721
  background: transparent;
675
722
  }
676
723
 
677
- .marked-extended-accordion-header {
724
+ .mx-accordion-header {
678
725
  padding: 0.75rem 1rem;
679
726
  background: rgba(0, 102, 204, 0.05);
680
727
  border-radius: 4px;
681
728
  list-style: none;
682
729
  }
683
730
 
684
- .marked-extended-accordion-header::-webkit-details-marker {
731
+ .mx-accordion-header::-webkit-details-marker {
685
732
  display: none;
686
733
  }
687
734
 
688
- .marked-extended-accordion[open] .marked-extended-accordion-header {
735
+ .mx-accordion[open] .mx-accordion-header {
689
736
  background: rgba(0, 102, 204, 0.1);
690
737
  border-radius: 4px 4px 0 0;
691
738
  }
692
739
 
693
- .marked-extended-accordion-content {
740
+ .mx-accordion-content {
694
741
  padding: 1rem 1rem 1rem 1.5rem;
695
742
  }
696
743
  ```
697
744
 
698
745
  Check the [demo](https://fsegurai.github.io/marked-extensions) to see various styling examples in action.
699
746
 
747
+ ### CSS classes and custom properties
748
+
749
+ Every class follows the shared 18.1.0 convention: root `mx-accordion`, parts `mx-accordion-<part>`, modifiers
750
+ `mx-accordion--<modifier>`. Class tokens (`mx-accordion-<key>-<value>`) carry configuration and are read by
751
+ `attachAccordion`; do not style them, except the icon tokens listed below. The class names derive from the `className`
752
+ option (default `mx-accordion`).
753
+
754
+ | Class | Element | Purpose |
755
+ |---------------------------------------|-----------------------------|---------------------------------------------------------------------------|
756
+ | `mx-accordion` | `<details>` | Root of one accordion |
757
+ | `mx-accordion--<variant>` | `<details>` | Variant modifier (`note`, `tip`, `important`, `warning`, `caution`, custom) |
758
+ | `mx-accordion-header` | `<summary>` | Clickable header |
759
+ | `mx-accordion-title` | `<h1>`…`<h6>` | Title |
760
+ | `mx-accordion-icon` | `<span>` | Icon (explicit `icon` or variant icon) |
761
+ | `mx-accordion-icon-<variant>` | `<span>` | Class token of a built-in CSS (mask) icon |
762
+ | `mx-accordion-content` | `<div>` | Body |
763
+ | `mx-accordion-id-*`, `-group-*`, `-duration-*`, `-easing-*`, `-data*-*` | `<details>` | Class tokens read by the runtime |
764
+
765
+ Classes owned by others: `octicon` (inline Octicon `<svg>` icons with `unsafeHtml: true`) and `body.light` /
766
+ `body.dark` (the host page's theme switch, read by `accordion-theme.css`).
767
+
768
+ | Custom property | Default | Used for |
769
+ |--------------------------------------------------|-------------------------------|--------------------------------------------------|
770
+ | `--mx-accordion-animation-duration` | `0.3s` | Open animation duration (set per block by the runtime) |
771
+ | `--mx-accordion-transition-timing` | `ease-in-out` | Content transition timing (set per block by the runtime) |
772
+ | `--mx-accordion-animation-easing` | `ease` | Open animation easing |
773
+ | `--mx-accordion-fade-distance` | `-10px` | Vertical offset of the open animation |
774
+ | `--mx-accordion-icon-gap` | `0.5rem` | Space between icon and title |
775
+ | `--mx-accordion-icon-size` | `16px` | Size of the built-in CSS icons |
776
+ | `--mx-accordion-icon` | per variant | Mask image of a built-in icon |
777
+ | `--mx-accordion-border-color` | `#ddd` | Border (theme) |
778
+ | `--mx-accordion-border-width` | `1px` | Border width (theme) |
779
+ | `--mx-accordion-background-color` | `#ffffff` | Background (theme) |
780
+ | `--mx-accordion-header-background-color` | `#f5f5f5` | Header background (theme) |
781
+ | `--mx-accordion-header-hover-background-color` | `#e8e8e8` | Header hover background (theme) |
782
+ | `--mx-accordion-hover-duration` | `0.2s` | Header hover transition (theme) |
783
+ | `--mx-accordion-text-color` | `#333` | Header and title text (theme) |
784
+ | `--mx-accordion-content-color` | `#24292e` | Body text (theme) |
785
+ | `--mx-accordion-radius` | `4px` | Corner radius (theme) |
786
+ | `--mx-accordion-margin` | `1rem 0` | Outer margin (theme) |
787
+ | `--mx-accordion-header-padding` | `0.75rem 1rem` | Header padding (theme) |
788
+ | `--mx-accordion-content-padding` | `1rem` | Body padding (theme) |
789
+ | `--mx-accordion-accent-width` | `4px` | Left accent of a variant (theme) |
790
+ | `--mx-accordion-<variant>-color` | GitHub alert palette | Accent and icon colour of a variant (theme) |
791
+
792
+ #### Migration from 18.x class names
793
+
794
+ | 18.0.x | 18.1.0 |
795
+ |---------------------------------------------|---------------------------------------|
796
+ | `marked-extended-accordion` | `mx-accordion` |
797
+ | `marked-extended-accordion-<variant>` | `mx-accordion--<variant>` |
798
+ | `marked-extended-accordion-header` | `mx-accordion-header` |
799
+ | `marked-extended-accordion-title` | `mx-accordion-title` |
800
+ | `marked-extended-accordion-icon` | `mx-accordion-icon` |
801
+ | `marked-extended-accordion-content` | `mx-accordion-content` |
802
+ | `--marked-extended-accordion-*` | `--mx-accordion-*` |
803
+
700
804
  ### Configuration Options
701
805
 
702
806
  The accordion extension accepts several configuration options when initializing. Pass them as an object to the extension
@@ -716,7 +820,7 @@ marked.use(markedExtendedAccordion({
716
820
 
717
821
  | Option | Type | Default | Description |
718
822
  |---------------------|-------------|-------------------------------|------------------------------------------------------------------------------------------|
719
- | `className` | `string` | `'marked-extended-accordion'` | Base CSS class name applied to all accordion containers |
823
+ | `className` | `string` | `'mx-accordion'` | Base CSS class name applied to all accordion containers |
720
824
  | `prefixId` | `string` | `'accordion-'` | Prefix for generating unique accordion IDs |
721
825
  | `animationDuration` | `string` | `'0.3s'` | Default animation duration (can be overridden per accordion) |
722
826
  | `animationEasing` | `string` | `'ease-in-out'` | Default animation timing function (can be overridden per accordion via `easing`) |
@@ -725,6 +829,19 @@ marked.use(markedExtendedAccordion({
725
829
  | `template` | `string` | `null` | Custom HTML template for rendering (see [Custom Templates](#custom-html-template)) |
726
830
  | `customizeToken` | `function` | `null` | Function to customize tokens before rendering |
727
831
 
832
+ #### Exports and constants (18.1.0)
833
+
834
+ ```javascript
835
+ import markedExtendedAccordion, {
836
+ markedExtendedAccordion as accordion, // same factory, named export
837
+ ACCORDION_VARIANTS, // ['note', 'tip', 'important', 'warning', 'caution'] (frozen)
838
+ ACCORDION_ICON_POSITIONS, // ['before', 'after'] (frozen)
839
+ } from '@fsegurai/marked-extended-accordion';
840
+ ```
841
+
842
+ The factory returns a `MarkedExtension`. The accordion renders no fixed text of its own (titles, icons and content come
843
+ from your Markdown), so it has no `labels` option.
844
+
728
845
  #### Markdown Syntax Properties
729
846
 
730
847
  These properties are specified in the accordion's front matter:
@@ -861,7 +978,7 @@ Generated attribute: `<details id="pricing" ...>`.
861
978
  #### Optional Icon
862
979
 
863
980
  Set `icon` to render a character or emoji before the title. The icon is wrapped in
864
- `<span class="marked-extended-accordion-icon" aria-hidden="true">`.
981
+ `<span class="mx-accordion-icon" aria-hidden="true">`.
865
982
 
866
983
  `````markdown
867
984
  ```accordion
@@ -872,7 +989,7 @@ Follow these steps to get up and running quickly.
872
989
  ```
873
990
  `````
874
991
 
875
- The `.marked-extended-accordion-icon` class provides structural styling for positioning the icon relative to the title.
992
+ The `.mx-accordion-icon` class provides structural styling for positioning the icon relative to the title.
876
993
 
877
994
  #### Icon Position
878
995
 
@@ -914,8 +1031,8 @@ marked.use(markedExtendedAccordion({
914
1031
  }));
915
1032
  ```
916
1033
 
917
- The variant name is also emitted as a modifier class (`{className}-{variant}`, e.g.
918
- `marked-extended-accordion-warning`), so you can target it from CSS.
1034
+ The variant name is also emitted as a modifier class (`{className}--{variant}`, e.g.
1035
+ `mx-accordion--warning`), so you can target it from CSS.
919
1036
 
920
1037
  #### Custom Classes and Data Attributes
921
1038
 
@@ -928,7 +1045,7 @@ title: Tracked panel
928
1045
  class: highlight featured
929
1046
  data-analytics-id: faq-pricing
930
1047
  ---
931
- Renders as `<details class="marked-extended-accordion highlight featured" data-analytics-id="faq-pricing">`.
1048
+ Renders as `<details class="mx-accordion highlight featured" data-analytics-id="faq-pricing">`.
932
1049
  ```
933
1050
  `````
934
1051
 
@@ -1119,19 +1236,19 @@ marked.use(markedExtendedAccordion({
1119
1236
  | Placeholder | Description | Example Value |
1120
1237
  |-----------------------|------------------------------------------------------------------------|----------------------------------------------------------------------------------|
1121
1238
  | `{accordionId}` | Unique identifier for the accordion | `accordion-abc123` |
1122
- | `{className}` | Base CSS class name | `marked-extended-accordion` |
1123
- | `{variantClass}` | Variant modifier class (leading space), empty when no variant | ` marked-extended-accordion-warning` or `` |
1239
+ | `{className}` | Base CSS class name | `mx-accordion` |
1240
+ | `{variantClass}` | Variant modifier class (leading space), empty when no variant | ` mx-accordion--warning` or `` |
1124
1241
  | `{extraClasses}` | Per-block classes from `class` (leading space), empty when none | ` highlight featured` or `` |
1125
1242
  | `{expandedAttr}` | `open` attribute if expanded, empty otherwise | `open` or `` |
1126
1243
  | `{headingTag}` | HTML heading tag based on level | `h2`, `h3`, etc. |
1127
1244
  | `{title}` | Accordion title text (may contain inline HTML) | `My Accordion` |
1128
1245
  | `{content}` | Rendered markdown content | `<p>Content...</p>` |
1129
1246
  | `{animationDuration}` | Animation duration value | `0.3s` |
1130
- | `{styleAttr}` | Inline CSS variables for duration and easing | `--marked-extended-accordion-animation-duration: 0.3s; ...` |
1247
+ | `{styleAttr}` | Inline CSS variables for duration and easing | `--mx-accordion-animation-duration: 0.3s; ...` |
1131
1248
  | `{expanded}` | Boolean string value | `true` or `false` |
1132
1249
  | `{nameAttr}` | `name="group"` attribute for exclusive accordions, empty when no group | `name="faq"` or `` |
1133
1250
  | `{dataAttrs}` | Serialized custom `data-*` attributes, empty when none | ` data-id="42"` or `` |
1134
- | `{icon}` | Icon span markup (before-title alias), empty when no icon | `<span class="marked-extended-accordion-icon" aria-hidden="true">➤</span>` or `` |
1251
+ | `{icon}` | Icon span markup (before-title alias), empty when no icon | `<span class="mx-accordion-icon" aria-hidden="true">➤</span>` or `` |
1135
1252
  | `{iconBefore}` | Icon span markup when positioned before the title, empty otherwise | same as `{icon}` or `` |
1136
1253
  | `{iconAfter}` | Icon span markup when positioned after the title, empty otherwise | same as `{icon}` or `` |
1137
1254
 
@@ -1170,13 +1287,13 @@ marked.use(markedExtendedAccordion({
1170
1287
  2. **CSS Animations**: Use CSS transforms for better performance:
1171
1288
 
1172
1289
  ```css
1173
- .marked-extended-accordion-content {
1290
+ .mx-accordion-content {
1174
1291
  transform-origin: top;
1175
1292
  transition: transform 0.3s ease, opacity 0.3s ease;
1176
1293
  }
1177
1294
 
1178
1295
  /* Use will-change sparingly, only when needed */
1179
- .marked-extended-accordion-header:hover ~ .marked-extended-accordion-content {
1296
+ .mx-accordion-header:hover ~ .mx-accordion-content {
1180
1297
  will-change: transform, opacity;
1181
1298
  }
1182
1299
  ```
@@ -1186,7 +1303,7 @@ marked.use(markedExtendedAccordion({
1186
1303
  4. **Content Loading**: For very large content blocks, consider using `content-visibility`:
1187
1304
 
1188
1305
  ```css
1189
- .marked-extended-accordion-content {
1306
+ .mx-accordion-content {
1190
1307
  content-visibility: auto;
1191
1308
  contain-intrinsic-size: 0 500px; /* Estimated height */
1192
1309
  }
@@ -1290,7 +1407,7 @@ accordion.addEventListener('toggle', (event) => {
1290
1407
  2. Check for conflicting CSS that might disable pointer events:
1291
1408
  ```css
1292
1409
  /* Remove if present */
1293
- .marked-extended-accordion-header {
1410
+ .mx-accordion-header {
1294
1411
  pointer-events: none; /* ❌ This breaks functionality */
1295
1412
  }
1296
1413
  ```
@@ -1319,11 +1436,11 @@ accordion.addEventListener('toggle', (event) => {
1319
1436
  **Solution**: Hide the default marker:
1320
1437
 
1321
1438
  ```css
1322
- .marked-extended-accordion-header::-webkit-details-marker {
1439
+ .mx-accordion-header::-webkit-details-marker {
1323
1440
  display: none;
1324
1441
  }
1325
1442
 
1326
- .marked-extended-accordion-header {
1443
+ .mx-accordion-header {
1327
1444
  list-style: none; /* Firefox */
1328
1445
  }
1329
1446
  ```
@@ -1335,14 +1452,14 @@ accordion.addEventListener('toggle', (event) => {
1335
1452
  **Solution**:
1336
1453
 
1337
1454
  ```css
1338
- .marked-extended-accordion-content {
1455
+ .mx-accordion-content {
1339
1456
  overflow: hidden;
1340
1457
  word-wrap: break-word;
1341
1458
  overflow-wrap: break-word;
1342
1459
  }
1343
1460
 
1344
1461
  /* For code blocks */
1345
- .marked-extended-accordion-content pre {
1462
+ .mx-accordion-content pre {
1346
1463
  overflow-x: auto;
1347
1464
  max-width: 100%;
1348
1465
  }
@@ -1359,13 +1476,13 @@ accordion.addEventListener('toggle', (event) => {
1359
1476
 
1360
1477
  ```css
1361
1478
  /* Smooth animation with max-height trick */
1362
- .marked-extended-accordion-content {
1479
+ .mx-accordion-content {
1363
1480
  max-height: 0;
1364
1481
  overflow: hidden;
1365
1482
  transition: max-height 0.3s ease-out;
1366
1483
  }
1367
1484
 
1368
- .marked-extended-accordion[open] .marked-extended-accordion-content {
1485
+ .mx-accordion[open] .mx-accordion-content {
1369
1486
  max-height: 2000px; /* Large enough value */
1370
1487
  transition: max-height 0.3s ease-in;
1371
1488
  }
@@ -1374,7 +1491,7 @@ accordion.addEventListener('toggle', (event) => {
1374
1491
  2. Use `will-change` sparingly for better performance:
1375
1492
 
1376
1493
  ```css
1377
- .marked-extended-accordion:hover .marked-extended-accordion-content {
1494
+ .mx-accordion:hover .mx-accordion-content {
1378
1495
  will-change: max-height;
1379
1496
  }
1380
1497
  ```
@@ -1587,7 +1704,7 @@ Optional advanced settings
1587
1704
  Ensure tap targets are large enough (minimum 44×44px):
1588
1705
 
1589
1706
  ```css
1590
- .marked-extended-accordion-header {
1707
+ .mx-accordion-header {
1591
1708
  min-height: 44px;
1592
1709
  padding: 12px 16px;
1593
1710
  }
@@ -1738,7 +1855,7 @@ interface AccordionVariant {
1738
1855
  }
1739
1856
 
1740
1857
  interface AccordionOptions {
1741
- className?: string; // Base CSS class (default: 'marked-extended-accordion')
1858
+ className?: string; // Base CSS class (default: 'mx-accordion')
1742
1859
  prefixId?: string; // ID prefix (default: 'accordion-')
1743
1860
  animationDuration?: string; // Animation duration (default: '0.3s')
1744
1861
  animationEasing?: string; // Animation timing function (default: 'ease-in-out')
@@ -2021,24 +2138,45 @@ on [GitHub](https://github.com/fsegurai/marked-extensions/issues).
2021
2138
  - [Source Code](https://github.com/fsegurai/marked-extensions)
2022
2139
  - [npm Package](https://www.npmjs.com/package/@fsegurai/marked-extended-accordion)
2023
2140
 
2141
+ ### Base design tokens
2142
+
2143
+ `accordion-theme.css` / `.scss` derive these properties from the shared `--mx-*` base set when it is defined on
2144
+ `:root` (`:root`, `body.light` and `body.dark` rules alike):
2145
+
2146
+ - `--mx-border`: `--mx-accordion-border-color`
2147
+ - `--mx-surface`: `--mx-accordion-background-color`
2148
+ - `--mx-surface-muted`: `--mx-accordion-header-background-color`
2149
+ - `--mx-text`: `--mx-accordion-text-color`, `--mx-accordion-content-color`
2150
+ - `--mx-radius`: `--mx-accordion-radius`
2151
+ - `--mx-accent` / `--mx-success` / `--mx-warning` / `--mx-danger` (CSS theme): `--mx-accordion-note-color` /
2152
+ `--mx-accordion-tip-color` / `--mx-accordion-warning-color` / `--mx-accordion-caution-color`
2153
+
2154
+ The base token comes before the `--app-*` / `--md-sys-color-*` fallbacks the theme already reads;
2155
+ every `--mx-accordion-*` property keeps its previous default as the fallback (nothing changes while the base tokens are unset) and still wins when you set it. See the core README, *Design tokens (base set)*.
2156
+
2024
2157
  ### Available Extensions
2025
2158
 
2026
- | Extension | Package | Version | Description |
2027
- |-------------|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------|
2028
- | All - Bundle | [@fsegurai/marked-extended-bundle](https://www.npmjs.com/package/@fsegurai/marked-extended-bundle) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-bundle) | Includes all extensions in a single package for easy integration |
2029
- | Accordion | [@fsegurai/marked-extended-accordion](https://www.npmjs.com/package/@fsegurai/marked-extended-accordion) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-accordion) | Add collapsible accordion sections to your markdown |
2030
- | Alert | [@fsegurai/marked-extended-alert](https://www.npmjs.com/package/@fsegurai/marked-extended-alert) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-alert) | Create styled alert boxes for important information |
2031
- | Comments | [@fsegurai/marked-extended-comments](https://www.npmjs.com/package/@fsegurai/marked-extended-comments) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-comments) | Add comment sections with author and timestamp metadata |
2032
- | Embeds | [@fsegurai/marked-extended-embeds](https://www.npmjs.com/package/@fsegurai/marked-extended-embeds) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-embeds) | Easily embed content from various platforms (YouTube, Twitter, etc.) |
2033
- | Footnote | [@fsegurai/marked-extended-footnote](https://www.npmjs.com/package/@fsegurai/marked-extended-footnote) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-footnote) | Add footnotes with automatic numbering |
2034
- | Kanban | [@fsegurai/marked-extended-kanban](https://www.npmjs.com/package/@fsegurai/marked-extended-kanban) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-kanban) | Create kanban boards with customizable columns and cards |
2035
- | Lists | [@fsegurai/marked-extended-lists](https://www.npmjs.com/package/@fsegurai/marked-extended-lists) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-lists) | Enhanced list formatting options |
2036
- | Slide | [@fsegurai/marked-extended-slide](https://www.npmjs.com/package/@fsegurai/marked-extended-slide) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-slide) | Create slide decks directly from markdown content |
2037
- | Spoiler | [@fsegurai/marked-extended-spoiler](https://www.npmjs.com/package/@fsegurai/marked-extended-spoiler) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-spoiler) | Hide content behind spoiler tags |
2038
- | Tables | [@fsegurai/marked-extended-tables](https://www.npmjs.com/package/@fsegurai/marked-extended-tables) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-tables) | Advanced table formatting with cell spanning |
2039
- | Tabs | [@fsegurai/marked-extended-tabs](https://www.npmjs.com/package/@fsegurai/marked-extended-tabs) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-tabs) | Create tabbed content sections |
2040
- | Timeline | [@fsegurai/marked-extended-timeline](https://www.npmjs.com/package/@fsegurai/marked-extended-timeline) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-timeline) | Display content in an interactive timeline format |
2041
- | Typographic | [@fsegurai/marked-extended-typographic](https://www.npmjs.com/package/@fsegurai/marked-extended-typographic) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-typographic) | Improve typography with smart quotes, dashes, and more |
2159
+ | Extension | Package | Version | Downloads | Description |
2160
+ |-------------|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|-----------|----------------------------------------------------------------------|
2161
+ | All - Bundle | [@fsegurai/marked-extended-bundle](https://www.npmjs.com/package/@fsegurai/marked-extended-bundle) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-bundle) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-bundle) | Includes all extensions in a single package for easy integration |
2162
+ | Accordion | [@fsegurai/marked-extended-accordion](https://www.npmjs.com/package/@fsegurai/marked-extended-accordion) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-accordion) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-accordion) | Add collapsible accordion sections to your markdown |
2163
+ | Alert | [@fsegurai/marked-extended-alert](https://www.npmjs.com/package/@fsegurai/marked-extended-alert) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-alert) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-alert) | Create styled alert boxes for important information |
2164
+ | Code | [@fsegurai/marked-extended-code](https://www.npmjs.com/package/@fsegurai/marked-extended-code) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-code) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-code) | Code blocks with titles, line numbers, highlights and diff markers |
2165
+ | Comments | [@fsegurai/marked-extended-comments](https://www.npmjs.com/package/@fsegurai/marked-extended-comments) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-comments) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-comments) | Add comment sections with author and timestamp metadata |
2166
+ | Embeds | [@fsegurai/marked-extended-embeds](https://www.npmjs.com/package/@fsegurai/marked-extended-embeds) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-embeds) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-embeds) | Easily embed content from various platforms (YouTube, Twitter, etc.) |
2167
+ | Footnote | [@fsegurai/marked-extended-footnote](https://www.npmjs.com/package/@fsegurai/marked-extended-footnote) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-footnote) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-footnote) | Add footnotes with automatic numbering |
2168
+ | Inline | [@fsegurai/marked-extended-inline](https://www.npmjs.com/package/@fsegurai/marked-extended-inline) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-inline) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-inline) | Inline marks: ==highlight==, optional ++insert++, ^superscript^ and ~subscript~ |
2169
+ | Kanban | [@fsegurai/marked-extended-kanban](https://www.npmjs.com/package/@fsegurai/marked-extended-kanban) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-kanban) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-kanban) | Create kanban boards with customizable columns and cards |
2170
+ | Lists | [@fsegurai/marked-extended-lists](https://www.npmjs.com/package/@fsegurai/marked-extended-lists) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-lists) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-lists) | Enhanced list formatting options |
2171
+ | Slide | [@fsegurai/marked-extended-slide](https://www.npmjs.com/package/@fsegurai/marked-extended-slide) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-slide) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-slide) | Create slide decks directly from markdown content |
2172
+ | Source Map | [@fsegurai/marked-extended-source-map](https://www.npmjs.com/package/@fsegurai/marked-extended-source-map) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-source-map) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-source-map) | Source line numbers and safe heading ids for editor-preview scroll sync |
2173
+ | Spoiler | [@fsegurai/marked-extended-spoiler](https://www.npmjs.com/package/@fsegurai/marked-extended-spoiler) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-spoiler) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-spoiler) | Hide content behind spoiler tags |
2174
+ | Tables | [@fsegurai/marked-extended-tables](https://www.npmjs.com/package/@fsegurai/marked-extended-tables) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-tables) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-tables) | Advanced table formatting with cell spanning |
2175
+ | Tabs | [@fsegurai/marked-extended-tabs](https://www.npmjs.com/package/@fsegurai/marked-extended-tabs) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-tabs) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-tabs) | Create tabbed content sections |
2176
+ | Timeline | [@fsegurai/marked-extended-timeline](https://www.npmjs.com/package/@fsegurai/marked-extended-timeline) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-timeline) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-timeline) | Display content in an interactive timeline format |
2177
+ | TOC | [@fsegurai/marked-extended-toc](https://www.npmjs.com/package/@fsegurai/marked-extended-toc) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-toc) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-toc) | Generate a table of contents with [toc] or [toc:N] |
2178
+ | Typographic | [@fsegurai/marked-extended-typographic](https://www.npmjs.com/package/@fsegurai/marked-extended-typographic) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-typographic) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-typographic) | Improve typography with smart quotes, dashes, and more |
2179
+ | Wikilinks | [@fsegurai/marked-extended-wikilinks](https://www.npmjs.com/package/@fsegurai/marked-extended-wikilinks) | ![npm](https://img.shields.io/npm/v/@fsegurai/marked-extended-wikilinks) | ![downloads](https://img.shields.io/npm/dt/@fsegurai/marked-extended-wikilinks) | Wiki-style [[target#heading\|alias]] links resolved by your callback |
2042
2180
 
2043
2181
  ### Demo Application
2044
2182