Skip to content

RFC: Ansi output options #99

@brism17

Description

@brism17

Nteract desktop app and jupyter extension currently uses the ansi-to-react library that takes four props to configure the ansi outputs. I want to configure the passing of optional options to the ansi object the controls stream and error outputs.

Motivation

Azure notebooks needs to change some of the default ansi values to fit our customers' needs. We understand that what is best for our product might not be what is best for other consumers of nteract. Making these options configurable will help all nteract consumers create the best experience to fit their needs.

Goals:

  • Azure notebooks wants to make links in error outputs clickable.
  • Azure notebooks wants to improve the accessibility of ansi outputs foreground colors to make certain outputs more visible in our themes.

Design and Implementation

Ansi to react has four properties that are passed down as props found here

 declare interface Props {
        children?: string;
        linkify?: boolean;
        className?: string;
      useClasses?: boolean;
  }

I want to add two of these options: useClasses and Linkify, to be passed down via the kernel-output-error class and the stream-text.tsx so that individual consumers have the power to control how ansi outputs are rendered. These options will be added to the existing props for these output classes.
The following is kernel-ouput-error:

   interface Props {
     className?: string;
     output: ImmutableErrorOutput;
     output_type: "error";
     linkify?: boolean;
     useClasses?: boolean;
  }

The following is stream-text:

  interface Props {
      output_type: "stream";
      output: ImmutableStreamOutput;
      linkify?: boolean;
      useClasses?: boolean;
   }

These options would override the default properties if provided which would match the current options in nteract.

Testing

To validate the correct behavior of the new ansi options I will add unit tests for the different options configurations and for if no options are provided..

Compatibility

If no options are provided I will provide default values that are the same as the current settings in nteract.

User Impact

No user impact if a user doesn't pass down options, the current behavior will stay the same. However, if a user chooses to pass down options they will have full control of how ansi outputs are rendered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions