The various notations are implemented in the output jax's menclose wrapper objects, using their notations map. If you add new entries to that map, you can create new non-standard enclosure types. Here is a configuration that adds a notation "angletop" that does what I hope you are looking for:
const {CHTMLmenclose} = MathJax._.output.chtml.Wrappers.menclose;
const a = .3; // skew angle in radians
CHTMLmenclose.notations.set('angletop', {
renderer: (node, child) => {
const {h, d, w} = node.getBBox();
const t = node.thickness;
const W = (h + d) * Math.tan(a);
const angle = node.adjustBorder(node.html('mjx-angle', {style: {
width: 0, height: node.em(h + d - t),
transform: 'skewX(' + node.fixed(-a) + 'rad) translateX(' + node.em(W) + ')',
'transform-origin': 'top right',
'border-right': node.em(t) + ' solid',
const top = node.adjustBorder(node.html('mjx-topline', {style: {
'border-top': node.em(node.thickness) + ' solid',
node.adaptor.append(node.chtml, angle);
node.adaptor.append(node.chtml, top);
const {h, d} = node.childNodes[0].getBBox();
const p = node.padding / 2;
const t = node.thickness;
const w = (h + d + 3 * p) * Math.tan(a);
return [2 * p + t, p, p, w];
border: (node) => [node.thickness, 0, 0, 0]
MathJax.startup.defaultReady();
I wasn't sure how you wanted the angled portion to change depending on the height of the content, so I made is be at a fixed angle, as that seemed to look best over a variety of sizes. The angle is given by the const a = .3 near the top, and you can change that to suit your taste. It works by creating two extra elements for the angles and top lines, and skewing the angled line, then placing them in the correct locations. The bbox method gives the changes to the bounding box of the contents due to the enclosure (as an array of top, right, bottom, left deltas), and the border method tells how the border size is affected.
This is for the CHTML output, so if you are using SVG, this would need to be adjusted. And if you wanted it work work for both if the user switches the renderer via the contextual menu, then that would take a bit more work. But perhaps this gets you what you need.
Davide