Skip to content

Add smart detection of input language #111

Description

@hackonteur

I would like for coderay to be able to detect the input format by looking at the contents of the file. This would be particularly helpful in conjunction with #110: Add support for input from STDIN; since coderay can't use the file extension in that case.

I have two ideas for how to support this initially:

  • Detect a unified diff style input, for the example of piping a diff to coderay:
diff -U1 foo.txt bar.txt | coderay
  • Add support for Emacs mode hints. So coderay could understand that this means it should treat the input as C:
/* -*- mode: c -*- */

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions