• Create a new scalar token with value

    Values that represent an actual string but may be parsed as a different type should use a type other than 'PLAIN', as this function does not support any schema operations and won't check for such conflicts.

    Parameters

    • value: string

      The string representation of the value, which will have its content properly indented.

    • context: {
          end?: SourceToken[];
          implicitKey?: boolean;
          inFlow?: boolean;
          indent: number;
          offset?: number;
          type?: Type;
      }
      • Optionalend?: SourceToken[]

        Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.

      • OptionalimplicitKey?: boolean

        Being within an implicit key may affect the resolved type of the token's value.

      • OptionalinFlow?: boolean

        Is this scalar within a flow collection? This may affect the resolved type of the token's value.

      • indent: number

        The indent level of the token.

      • Optionaloffset?: number

        The offset position of the token.

      • Optionaltype?: Type

        The preferred type of the scalar token. If undefined, the previous type of the token will be used, defaulting to 'PLAIN'.

    Returns BlockScalar | FlowScalar