class MacrosNodeFormatter extends NodeRepositoryFormatter<MacroDefinitionRepository, MacroDefinitionBlock, MacroReference> {
    final public static DataKey<Map<String, String>> MACROS_TRANSLATION_MAP = new DataKey<>("MACROS_TRANSLATION_MAP", new HashMap<>());
    final public static DataKey<Map<String, String>> MACROS_UNIQUIFICATION_MAP = new DataKey<>("MACROS_UNIQUIFICATION_MAP", new HashMap<>()); // uniquified references
    final private MacroFormatOptions options;

    public MacrosNodeFormatter(DataHolder options) {
        super(options, MACROS_TRANSLATION_MAP, MACROS_UNIQUIFICATION_MAP);
        this.options = new MacroFormatOptions(options);
    }

    @Override
    public MacroDefinitionRepository getRepository(DataHolder options) {
        return MacrosExtension.MACRO_DEFINITIONS.get(options);
    }

    @Override
    public ElementPlacement getReferencePlacement() {
        return options.macrosPlacement;
    }

    @Override
    public ElementPlacementSort getReferenceSort() {
        return options.macrosSort;
    }

    @Override
    public void renderReferenceBlock(MacroDefinitionBlock node, NodeFormatterContext context, MarkdownWriter markdown) {<FILL_FUNCTION_BODY>}

    @Nullable
    @Override
    public Set<NodeFormattingHandler<?>> getNodeFormattingHandlers() {
        return new HashSet<>(Arrays.asList(
                new NodeFormattingHandler<>(MacroReference.class, MacrosNodeFormatter.this::render),
                new NodeFormattingHandler<>(MacroDefinitionBlock.class, MacrosNodeFormatter.this::render)
        ));
    }

    @Nullable
    @Override
    public Set<Class<?>> getNodeClasses() {
        if (options.macrosPlacement.isNoChange() || !options.macrosSort.isUnused()) return null;
        // noinspection ArraysAsListWithZeroOrOneArgument
        return new HashSet<>(Arrays.asList(
                MacroReference.class
        ));
    }

    private void render(MacroDefinitionBlock node, NodeFormatterContext context, MarkdownWriter markdown) {
        renderReference(node, context, markdown);
    }

    private void render(MacroReference node, NodeFormatterContext context, MarkdownWriter markdown) {
        markdown.append("<<<");
        if (context.isTransformingText()) {
            String referenceId = transformReferenceId(node.getText().toString(), context);
            context.nonTranslatingSpan((context1, markdown1) -> markdown1.append(referenceId));
        } else {
            markdown.append(node.getText());
        }
        markdown.append(">>>");
    }

    public static class Factory implements NodeFormatterFactory {
        @NotNull
        @Override
        public NodeFormatter create(@NotNull DataHolder options) {
            return new MacrosNodeFormatter(options);
        }
    }
}

        markdown.blankLine().append(">>>").append(transformReferenceId(node.getName().toString(), context)).line();
        Node child = node.getFirstChild();
        if (child instanceof Paragraph && child == node.getLastChild()) {
            // if a single paragraph then we unwrap it and output only its children as inline text
            context.renderChildren(child);
        } else {
            context.renderChildren(node);
        }
        markdown.line().append("<<<").blankLine();
    
<methods>public void <init>(com.vladsch.flexmark.util.data.DataHolder, DataKey<Map<java.lang.String,java.lang.String>>, DataKey<Map<java.lang.String,java.lang.String>>) ,public @Nullable Set<FormattingPhase> getFormattingPhases() ,public Comparator<com.vladsch.flexmark.ext.macros.MacroDefinitionBlock> getReferenceComparator() ,public abstract com.vladsch.flexmark.util.format.options.ElementPlacement getReferencePlacement() ,public abstract com.vladsch.flexmark.util.format.options.ElementPlacementSort getReferenceSort() ,public abstract com.vladsch.flexmark.ext.macros.internal.MacroDefinitionRepository getRepository(com.vladsch.flexmark.util.data.DataHolder) ,public java.lang.String modifyTransformedReference(java.lang.String, com.vladsch.flexmark.formatter.NodeFormatterContext) ,public void renderDocument(@NotNull NodeFormatterContext, @NotNull MarkdownWriter, @NotNull Document, @NotNull FormattingPhase) <variables>public static final HashSet<com.vladsch.flexmark.formatter.FormattingPhase> FORMATTING_PHASES,protected final non-sealed com.vladsch.flexmark.ext.macros.MacroDefinitionBlock lastReference,protected final non-sealed Comparator<com.vladsch.flexmark.ext.macros.MacroDefinitionBlock> myComparator,private final non-sealed DataKey<Map<java.lang.String,java.lang.String>> myReferenceMapKey,private final non-sealed DataKey<Map<java.lang.String,java.lang.String>> myReferenceUniqificationMapKey,protected boolean recheckUndefinedReferences,protected final non-sealed List<com.vladsch.flexmark.ext.macros.MacroDefinitionBlock> referenceList,protected final non-sealed com.vladsch.flexmark.ext.macros.internal.MacroDefinitionRepository referenceRepository,private Map<java.lang.String,java.lang.String> referenceTranslationMap,protected Map<java.lang.String,java.lang.String> referenceUniqificationMap,protected boolean repositoryNodesDone,protected final non-sealed HashSet<com.vladsch.flexmark.util.ast.Node> unusedReferences