• Expands macros in ast as specified by macros, but do not expand any macros that appear in the context of a macro definition. For example, expanding \foo to X in

    \newcommand{\foo}{Y}
    \foo

    would result in

    \newcommand{\foo}{Y}
    X

    If expandMacros(...) were used, macros would be expanded in all contexts and the result would be

    \newcommand{X}{Y}
    X

    Each macro in macros should provide the substitution AST (i.e., the AST with the #1, etc. in it). This function assumes that the appropriate arguments have already been attached to each macro specified. If the macro doesn't have it's arguments attached, its contents will be wholesale replaced with its substitution AST.

    Parameters

    • tree: Ast
    • macros: {
          body: Node[];
          name: string;
      }[]

    Returns void

Generated using TypeDoc