class AttributesAttributeProvider implements AttributeProvider {
    final private NodeAttributeRepository nodeAttributeRepository;
    final private AttributesOptions attributeOptions;

    public AttributesAttributeProvider(LinkResolverContext context) {
        DataHolder options = context.getOptions();
        attributeOptions = new AttributesOptions(options);
        nodeAttributeRepository = AttributesExtension.NODE_ATTRIBUTES.get(options);
    }

    @Override
    public void setAttributes(@NotNull Node node, @NotNull AttributablePart part, @NotNull MutableAttributes attributes) {<FILL_FUNCTION_BODY>}

    public static class Factory extends IndependentAttributeProviderFactory {
        //@Override
        //public Set<Class<?>> getAfterDependents() {
        //    return null;
        //}
        //
        //@Override
        //public Set<Class<?>> getBeforeDependents() {
        //    return null;
        //}
        //
        //@Override
        //public boolean affectsGlobalScope() {
        //    return false;
        //}

        @NotNull
        @Override
        public AttributeProvider apply(@NotNull LinkResolverContext context) {
            return new AttributesAttributeProvider(context);
        }
    }
}

        // regression bug, issue #372, add option, default to both as before
        if (part == CoreNodeRenderer.CODE_CONTENT ? attributeOptions.fencedCodeAddAttributes.addToCode : attributeOptions.fencedCodeAddAttributes.addToPre) {
            ArrayList<AttributesNode> nodeAttributesList = nodeAttributeRepository.get(node);
            if (nodeAttributesList != null) {
                // add these as attributes
                for (AttributesNode nodeAttributes : nodeAttributesList) {
                    for (Node attribute : nodeAttributes.getChildren()) {
                        if (!(attribute instanceof AttributeNode)) continue;

                        final AttributeNode attributeNode = (AttributeNode) attribute;
                        if (!attributeNode.isImplicitName()) {
                            final BasedSequence attributeNodeName = attributeNode.getName();
                            if (attributeNodeName.isNotNull() && !attributeNodeName.isBlank()) {
                                if (!attributeNodeName.equals(CLASS_ATTR)) {
                                    attributes.remove(attributeNodeName);
                                }
                                attributes.addValue(attributeNodeName, attributeNode.getValue());
                            } else {
                                // empty then ignore
                            }
                        } else {
                            // implicit
                            if (attributeNode.isClass()) {
                                attributes.addValue(CLASS_ATTR, attributeNode.getValue());
                            } else if (attributeNode.isId()) {
                                if (node instanceof AnchorRefTarget) {
                                    // was already provided via setAnchorRefId
                                } else {
                                    attributes.remove(Attribute.ID_ATTR);
                                    attributes.addValue(Attribute.ID_ATTR, attributeNode.getValue());
                                }
                            } else {
                                // unknown
                                throw new IllegalStateException("Implicit attribute yet not class or id");
                            }
                        }
                    }
                }
            }
        }
    
<no_super_class>