build(aio): render heading anchors on the right
This approach simplifies the styling needed considerably. Previously, we had to make room on the left for heading that are in visual containers. Also we had to apply a `float:right` when on narrow screens as the gutter not available then. This float didn't render nicely if the heading text was longer than could be rendered on a single line. Closes #22131
This commit is contained in:

committed by
Alex Eagle

parent
8d34364ff5
commit
83b32a0a0a
@ -20,7 +20,7 @@ const hasClass = (node, cls) => {
|
||||
const link = options =>
|
||||
tree => visit(tree, node => {
|
||||
if (is(node, HEADINGS) && has(node, 'id') && !hasClass(node, NO_ANCHOR_CLASS)) {
|
||||
node.children.unshift({
|
||||
node.children.push({
|
||||
type: 'element',
|
||||
tagName: 'a',
|
||||
properties: Object.assign(clone(options.properties), {href: `#${node.properties.id}`}),
|
||||
|
Reference in New Issue
Block a user