9 lines
271 B
JavaScript
9 lines
271 B
JavaScript
// getId expects the image reference node to be the sole node in a paragraph
|
|
function getId(node) {
|
|
const { type, name, attributes } = node;
|
|
if (type !== 'leafDirective' || name !== 'id' || !attributes) return null;
|
|
return attributes.id;
|
|
}
|
|
|
|
module.exports = getId;
|