border-bottom-right-radius: 0;
}
+/* "Nopad" code block inside a code/console figure -- show code and console
+ output nicely packed together */
+.m-code-figure > pre.m-nopad, .m-console-figure > pre.m-nopad {
+ margin-left: -0.875rem;
+ margin-right: -0.875rem;
+ margin-top: -1rem;
+ margin-bottom: -0.875rem;
+ padding-left: 0.875rem;
+}
+
/* Figure caption */
figure.m-figure figcaption, .m-code-figure figcaption, .m-console-figure figcaption {
margin-top: 0.5rem;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
+.m-code-figure > pre.m-nopad, .m-console-figure > pre.m-nopad {
+ margin-left: -0.875rem;
+ margin-right: -0.875rem;
+ margin-top: -1rem;
+ margin-bottom: -0.875rem;
+ padding-left: 0.875rem;
+}
figure.m-figure figcaption, .m-code-figure figcaption, .m-console-figure figcaption {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
border-bottom-left-radius: 0;
border-left-width: 0.25rem;
}
+.m-container-inflatable section:target > .m-code-figure > pre.m-nopad,
+.m-container-inflatable section:target > .m-console-figure > pre.m-nopad {
+ margin-left: -0.75rem;
+ padding-left: -0.75rem;
+}
@media screen and (min-width: 576px) {
.m-container-inflatable section:target .m-center-s > .m-note,
.m-container-inflatable section:target .m-center-s > pre,
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
+.m-code-figure > pre.m-nopad, .m-console-figure > pre.m-nopad {
+ margin-left: -0.875rem;
+ margin-right: -0.875rem;
+ margin-top: -1rem;
+ margin-bottom: -0.875rem;
+ padding-left: 0.875rem;
+}
figure.m-figure figcaption, .m-code-figure figcaption, .m-console-figure figcaption {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
border-bottom-left-radius: 0;
border-left-width: 0.25rem;
}
+.m-container-inflatable section:target > .m-code-figure > pre.m-nopad,
+.m-container-inflatable section:target > .m-console-figure > pre.m-nopad {
+ margin-left: -0.75rem;
+ padding-left: -0.75rem;
+}
@media screen and (min-width: 576px) {
.m-container-inflatable section:target .m-center-s > .m-note,
.m-container-inflatable section:target .m-center-s > pre,
border-bottom-left-radius: 0;
border-left-width: 0.25rem;
}
+.m-container-inflatable section:target > .m-code-figure > pre.m-nopad,
+.m-container-inflatable section:target > .m-console-figure > pre.m-nopad {
+ margin-left: -0.75rem;
+ padding-left: -0.75rem;
+}
/* Center/left/right are tied to particular breakpoint so we need to
conditionally revert that. Left-aligned content is touching the left border
both in full size and aligned, so we revert it only for center and right. */
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
+.m-code-figure > pre.m-nopad, .m-console-figure > pre.m-nopad {
+ margin-left: -0.875rem;
+ margin-right: -0.875rem;
+ margin-top: -1rem;
+ margin-bottom: -0.875rem;
+ padding-left: 0.875rem;
+}
figure.m-figure figcaption, .m-code-figure figcaption, .m-console-figure figcaption {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
border-bottom-left-radius: 0;
border-left-width: 0.25rem;
}
+.m-container-inflatable section:target > .m-code-figure > pre.m-nopad,
+.m-container-inflatable section:target > .m-console-figure > pre.m-nopad {
+ margin-left: -0.75rem;
+ padding-left: -0.75rem;
+}
@media screen and (min-width: 576px) {
.m-container-inflatable section:target .m-center-s > .m-note,
.m-container-inflatable section:target .m-center-s > pre,
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
+.m-code-figure > pre.m-nopad, .m-console-figure > pre.m-nopad {
+ margin-left: -0.875rem;
+ margin-right: -0.875rem;
+ margin-top: -1rem;
+ margin-bottom: -0.875rem;
+ padding-left: 0.875rem;
+}
figure.m-figure figcaption, .m-code-figure figcaption, .m-console-figure figcaption {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
border-bottom-left-radius: 0;
border-left-width: 0.25rem;
}
+.m-container-inflatable section:target > .m-code-figure > pre.m-nopad,
+.m-container-inflatable section:target > .m-console-figure > pre.m-nopad {
+ margin-left: -0.75rem;
+ padding-left: -0.75rem;
+}
@media screen and (min-width: 576px) {
.m-container-inflatable section:target .m-center-s > .m-note,
.m-container-inflatable section:target .m-center-s > pre,
<pre>And a resulting output.</pre>
</figure>
+Code figure with a "nopad" console output inside:
+
+.. raw:: html
+
+ <figure class="m-code-figure">
+ <pre class="m-code">Some
+ code
+ snippet</pre>
+ <pre class="m-console m-nopad">And a resulting output.</pre>
+ </figure>
+
+Console figure with a "nopad" code output inside:
+
+.. raw:: html
+
+ <figure class="m-console-figure">
+ <pre class="m-console">Some
+ console
+ output</pre>
+ <pre class="m-code m-nopad">And the code that goes out.</pre>
+ </figure>
+
Console figure:
.. raw:: html
It's also possible to have matching border for a console output. Just use
:css:`.m-console-figure` instead of :css:`.m-code-figure` on the outer element.
+For reduced clutter when combining a code figure with console output (and vice
+versa), mark the second :html:`<pre>` with :css:`.m-nopad`:
+
+.. code-figure::
+
+ .. code:: html
+
+ <figure class="m-code-figure">
+ <pre class="m-code">Some
+ code
+ snippet</pre>
+ <pre class="m-console m-nopad">And a resulting output.</pre>
+ </figure>
+
+ .. raw:: html
+
+ <figure class="m-code-figure">
+ <pre class="m-code">Some
+ code
+ snippet</pre>
+ <pre class="m-console m-nopad">And a resulting output.</pre>
+ </figure>
.. note-info::