0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-11 02:59:07 +08:00
discourse/plugins/discourse-math/assets/stylesheets/common/discourse-math.scss
Sam d31ca17c57
FEATURE: update mathjax to version 4.1 (#36814)
This upgrades to Mathjax 4.1 and latest katex
Implement rich text composer support for math
Adds support for /( )/ and /[ /] which was missing and very common now 
Removes math javascript from our repo

---------

Co-authored-by: Mark McClure <mcmcclur@unca.edu>
2026-01-09 08:24:31 +11:00

140 lines
3 KiB
SCSS
Vendored

// Hidden state controlled via hidden attribute set by JavaScript
[hidden].math-hidden {
display: none;
}
.math-container {
&.block-math {
display: block;
// MathJax container styling - inline styles are stripped by JavaScript
// after rendering to allow these CSS rules to take effect
> {
div,
span {
display: block;
max-width: 100%;
margin-bottom: 1em;
.katex-html {
display: block;
overflow-x: auto;
overflow-y: hidden;
max-width: 100%;
padding: 0.25em 0.5em;
box-sizing: border-box;
}
}
mjx-container {
display: block;
max-width: 100%;
margin-bottom: 1em;
overflow-x: auto;
overflow-y: hidden;
padding: 0.25em 0.5em;
box-sizing: border-box;
}
}
// On mobile we add a slight fade on either side to indicate that the user can
// scroll. However, this should not be added to the composer since mathjax does
// not render in the mobile composer
.cooked & {
.mobile-view & {
position: relative;
&::before {
content: "";
position: absolute;
z-index: 1;
left: 0;
top: 0;
width: 1em;
height: 100%;
background: linear-gradient(
to right,
rgb(var(--secondary-rgb), 1) 0%,
rgb(var(--secondary-rgb), 0) 100%
);
}
&::after {
content: "";
position: absolute;
z-index: 1;
right: 0;
top: 0;
width: 1em;
height: 100%;
background: linear-gradient(
to right,
rgb(var(--secondary-rgb), 0) 0%,
rgb(var(--secondary-rgb), 1) 100%
);
}
}
}
}
}
.ProseMirror {
.composer-math-node {
position: relative;
display: inline-flex;
align-items: baseline;
gap: var(--space-half);
padding: 0 var(--space-1);
border: 1px dashed var(--primary-low-mid);
border-radius: var(--d-border-radius);
background: var(--primary-very-low);
font-family: var(--d-font-family--monospace);
&.ProseMirror-selectednode {
outline-offset: -2px;
border-color: var(--tertiary);
}
.math-node-edit-button {
color: var(--primary-medium);
padding: 0;
&:hover {
color: var(--primary);
}
}
.math-node-content {
font-size: var(--font-down-1);
}
}
div.composer-math-node {
display: block;
padding: var(--space-2);
margin: var(--space-2) 0;
.math-node-content {
display: block;
white-space: pre-wrap;
}
}
}
.math-insert-modal,
.math-edit-modal {
&__toggle {
margin-bottom: var(--space-3);
}
&__textarea {
min-height: 100px;
font-family: var(--d-font-family--monospace);
}
}
// Fix zoom problem with MathJax.
// See https://github.com/mathjax/MathJax/issues/3489
.mjx-dialog {
position: fixed !important;
}