mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
Fix: Exclude headings in the carousel and modal examples from ToC (#2362)
This commit is contained in:
5
.changeset/stale-cherries-draw.md
Normal file
5
.changeset/stale-cherries-draw.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@tabler/docs": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: Exclude headings in the carousel and modal examples from ToC
|
||||||
@@ -226,7 +226,7 @@ export default function (eleventyConfig) {
|
|||||||
eleventyConfig.addFilter("toc", function (name) {
|
eleventyConfig.addFilter("toc", function (name) {
|
||||||
const toc = [];
|
const toc = [];
|
||||||
|
|
||||||
const contentWithoutExamples = name.replace(/<div[^>]*\bclass=["'][^"']*\bexample\b[^"']*".*?>.*?<\/div>/gs, '');
|
const contentWithoutExamples = name.replace(/<!--EXAMPLE-->[\s\S]*?<!--\/EXAMPLE-->/g, '');
|
||||||
const headings = contentWithoutExamples.match(/<h([23])>([^<]+)<\/h\1>/g);
|
const headings = contentWithoutExamples.match(/<h([23])>([^<]+)<\/h\1>/g);
|
||||||
|
|
||||||
if (headings) {
|
if (headings) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<!--EXAMPLE-->
|
||||||
<div
|
<div
|
||||||
class="example fs-base border rounded my-5{% unless include.raw %} d-flex flex-wrap justify-content-center{% endunless %} overflow-{{ include.overflow | default: 'auto' }} position-relative {% if include.bg %}bg-{{ include.bg }}{% endif %}{% if include.class %} {{ include.class }}{% endif %}"{% if include.height %} style="height: {{ include.height }}"{% endif %}{% unless include.bg %} style="background: url('data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'20\' height=\'20\' viewBox=\'0 0 20 20\'><rect fill=\'rgba(0, 0, 0, .01)\' x=\'0\' y=\'0\' width=\'10\' height=\'10\' /><rect fill=\'rgba(0, 0, 0, .01)\' x=\'10\' y=\'10\' width=\'10\' height=\'10\' /></svg>')"{% endunless %}}>
|
class="example fs-base border rounded my-5{% unless include.raw %} d-flex flex-wrap justify-content-center{% endunless %} overflow-{{ include.overflow | default: 'auto' }} position-relative {% if include.bg %}bg-{{ include.bg }}{% endif %}{% if include.class %} {{ include.class }}{% endif %}"{% if include.height %} style="height: {{ include.height }}"{% endif %}{% unless include.bg %} style="background: url('data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'20\' height=\'20\' viewBox=\'0 0 20 20\'><rect fill=\'rgba(0, 0, 0, .01)\' x=\'0\' y=\'0\' width=\'10\' height=\'10\' /><rect fill=\'rgba(0, 0, 0, .01)\' x=\'10\' y=\'10\' width=\'10\' height=\'10\' /></svg>')"{% endunless %}}>
|
||||||
{%- unless include.raw -%}<div class="p-6 w-full{% if include.column %} d-flex gap-3 flex-column{% elsif include.centered %} justify-content-center flex-fill flex-wrap gap-2{% if include.vertical %} flex-column{% endif %}{% endif %}" {% if include.column %}style="max-width: 25rem;"{% endif %}>{%- endunless -%}
|
{%- unless include.raw -%}<div class="p-6 w-full{% if include.column %} d-flex gap-3 flex-column{% elsif include.centered %} justify-content-center flex-fill flex-wrap gap-2{% if include.vertical %} flex-column{% endif %}{% endif %}" {% if include.column %}style="max-width: 25rem;"{% endif %}>{%- endunless -%}
|
||||||
@@ -10,3 +11,4 @@
|
|||||||
{{ html }}
|
{{ html }}
|
||||||
```
|
```
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
|
<!--/EXAMPLE-->
|
||||||
Reference in New Issue
Block a user