mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-13 06:58:40 +00:00
Revert frac-lines to borders (#1249)
* Revert frac-lines to borders This PR reverts the rendering of frac-lines from SVG paths back to span borders. This solves the thick grey bar reported by @mbourne in issue #1173. The result is a frac-line similar to KaTeX v0.9.0-alpha1. The frac-lines are span borders and the CSS contains a `min-width: 1px;` rule to keep those borders visible. There is one difference between this PR and v0.9.0-alpha1. The earlier work contained a second CSS rule: ``` @media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi) { .katex.mfra.fracline { min-height:0.5px; } } That second CSS rule did not help much. Instead, it caused some lines to disappear. In the thread to issue 1173, people tested the rendering from the proposed approach and reported that frac-lines disappeared only at sized that were already too small to read. * Fix lint errors * Remove superfluous SVG paths. * Remove superfluous CSS * Removed `rulespan` from `stretchy.js` * Support Unicode \ll and \lll Fixes issue #1271 * Fix indent * update screenshots for fracLineBorder * Update Arrays-chrome screenshot for fracLineBorder
This commit is contained in:
@@ -346,54 +346,8 @@ const encloseSpan = function(
|
||||
return img;
|
||||
};
|
||||
|
||||
const ruleSpan = function(
|
||||
className: string,
|
||||
lineThickness: number,
|
||||
options: Options,
|
||||
): SvgSpan {
|
||||
|
||||
// Get a span with an SVG path that fills the middle fifth of the span.
|
||||
// We're using an extra wide span so Chrome won't round it down to zero.
|
||||
|
||||
let path;
|
||||
let svgNode;
|
||||
let parentClass = "stretchy"; // default
|
||||
|
||||
if (className === "vertical-separator") {
|
||||
path = new domTree.pathNode("vertSeparator");
|
||||
svgNode = new domTree.svgNode([path], {
|
||||
"width": "0.25em", // contains a path that is 0.05 ems wide.
|
||||
"height": "400em",
|
||||
"viewBox": "0 0 250 400000",
|
||||
"preserveAspectRatio": "xMinYMin slice",
|
||||
});
|
||||
parentClass = "vertical-separator";
|
||||
|
||||
} else {
|
||||
// The next two lines are the only place in KaTeX where SVG paths are
|
||||
// put into a viewBox that is not always exactly a 1000:1 scale to the
|
||||
// document em size. Instead, the path is a horizontal line set to
|
||||
// take up the middle fifth of the viewBox and span. If the context is
|
||||
// normalsize/textstyle then the line will be 0.04em and the usual
|
||||
// 1000:1 ratio holds. But if the context is scriptstyle, then
|
||||
// lineThickness > 0.04em and we have a ratio somewhat different than
|
||||
// 1000:1.
|
||||
|
||||
path = new domTree.pathNode("stdHorizRule");
|
||||
svgNode = new domTree.svgNode([path], {
|
||||
"width": "400em",
|
||||
"height": 5 * lineThickness + "em",
|
||||
"viewBox": "0 0 400000 200",
|
||||
"preserveAspectRatio": "xMinYMin slice",
|
||||
});
|
||||
}
|
||||
|
||||
return buildCommon.makeSvgSpan([parentClass], [svgNode], options);
|
||||
};
|
||||
|
||||
export default {
|
||||
encloseSpan,
|
||||
mathMLnode,
|
||||
ruleSpan,
|
||||
svgSpan,
|
||||
};
|
||||
|
Reference in New Issue
Block a user