diff --git a/site/assets/js/partials/code-examples.js b/site/assets/js/partials/code-examples.js index d81191a96565..a5c14e10ecee 100644 --- a/site/assets/js/partials/code-examples.js +++ b/site/assets/js/partials/code-examples.js @@ -19,8 +19,8 @@ export default () => { const btnEdit = 'Edit on StackBlitz' const btnHtml = [ - '
', - '
', + '
', + '
', ' ', @@ -34,7 +34,7 @@ export default () => { // Ignore examples made by shortcode if (!element.closest('.bd-example-snippet')) { element.insertAdjacentHTML('beforebegin', btnHtml) - element.previousElementSibling.append(element) + element.previousElementSibling.prepend(element) } }) diff --git a/site/assets/scss/_component-examples.scss b/site/assets/scss/_component-examples.scss index fde8b7f4164a..2ec19ec34769 100644 --- a/site/assets/scss/_component-examples.scss +++ b/site/assets/scss/_component-examples.scss @@ -3,6 +3,8 @@ // .bd-code-snippet { + display: flex; + flex-direction: column; margin: 0 ($bd-gutter-x * -.5) 1rem; border: solid var(--bs-border-color); border-width: 1px 0; @@ -392,7 +394,11 @@ } .bd-file-ref { + position: relative; + .highlight-toolbar { + min-height: $spacer * 2.625; + @include media-breakpoint-up(md) { @include border-top-radius(calc(var(--bs-border-radius) - 1px)); } diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index 5b398e6814fc..8168dc11b6a2 100644 --- a/site/layouts/shortcodes/example.html +++ b/site/layouts/shortcodes/example.html @@ -21,14 +21,20 @@
{{- if eq $show_preview true }} - + {{ $content }}
{{- end }} {{- if eq $show_markup true -}} + + {{- $content = replaceRE `` `...` $content -}} + {{- $content = replaceRE `` `...` $content -}} + {{- $content = replaceRE ` (class=" *?")` "" $content -}} + {{- highlight (trim $content "\n") $lang "" -}} + {{- if eq $show_preview true -}} -
+
{{ $lang }}
{{- end -}} - - {{- $content = replaceRE `` `...` $content -}} - {{- $content = replaceRE `` `...` $content -}} - {{- $content = replaceRE ` (class=" *?")` "" $content -}} - {{- highlight (trim $content "\n") $lang "" -}} {{- end }}
diff --git a/site/layouts/shortcodes/js-docs.html b/site/layouts/shortcodes/js-docs.html index 8eed4a0eb18e..691b236cb1b7 100644 --- a/site/layouts/shortcodes/js-docs.html +++ b/site/layouts/shortcodes/js-docs.html @@ -34,14 +34,9 @@
{{- $unindent := 0 -}} @@ -66,5 +61,9 @@ {{- $output = $match -}} {{- end -}} {{- highlight $output "js" "" -}} + +
{{- end -}} diff --git a/site/layouts/shortcodes/scss-docs.html b/site/layouts/shortcodes/scss-docs.html index 6e7c129f4c29..4c454c037d2e 100644 --- a/site/layouts/shortcodes/scss-docs.html +++ b/site/layouts/shortcodes/scss-docs.html @@ -47,14 +47,9 @@
{{- $unindent := 0 -}} {{- $found := false -}} @@ -78,5 +73,9 @@ {{- $output = $match -}} {{- end -}} {{- highlight $output "scss" "" -}} + +
{{- end -}}