NamedEntityNode.java

/*
 * Copyright © 2026 The CTAN Team and individual authors
 *
 * This file is distributed under the 3-clause BSD license.
 * See file LICENSE for details.
 */

package org.ctan.markup.gfm.ext;

import org.commonmark.node.CustomNode;

/**
 * AST node produced by {@link NamedEntityExtension} for a named HTML entity
 * such as {@code &TeX;} or {@code &}.
 *
 * <p>
 * The {@link #name} field holds the bare entity name without the surrounding
 * {@code &} and {@code ;} delimiters.
 */
public final class NamedEntityNode extends CustomNode {

    /**
     * The field <code>name</code> contains the name of the entity.
     */
    private final String name;

    /**
     * This is the constructor for the class <code>NamedEntityNode</code>.
     *
     * @param name the name of the entity
     */
    public NamedEntityNode(String name) {

        this.name = name;
    }

    /**
     * Returns the entity name without {@code &} / {@code ;} (e.g.
     * {@code "TeX"}).
     */
    public String getName() {

        return name;
    }
}