neo4j-labs / arrows.app

A graph drawing application
https://arrows.app
Apache License 2.0
107 stars 16 forks source link

Add syntax highlighting in export code for "json", "cypher" and "graphql" #35

Open shivam-880 opened 3 years ago

shivam-880 commented 3 years ago

Proposal

Add syntax highlighting in export code for "json", "cypher" and "graphql". This will make the code readable.

Example:

type Movie {
    movieId: ID! 
    title: String!
    runtime: Int
    adult: Boolean!
    avgRating: Float
    numVotes: Int
    genres: [Genre] @relationship(type: "IN_GENRE", direction: OUT)
    releasedInYear: [Year] @relationship(type: "RELEASED_IN", direction: OUT)
    selves: [Person] @relationship(type: "SELF_IN", direction: IN)
    directors: [Person] @relationship(type: "DIRECTOR_IN", direction: IN)
    writers: [Person] @relationship(type: "WRITER_IN", direction: IN)
    actors: [Person] @relationship(type: "ACTOR_IN", direction: IN)
    actress: [Person] @relationship(type: "ACTRESS_IN", direction: IN)
    composers: [Person] @relationship(type: "COMPOSER_IN", direction: IN)
    productionDesigners: [Person] @relationship(type: "PRODUCTION_DESIGNER", direction: IN)
    editors: [Person] @relationship(type: "EDITOR_IN", direction: IN)
    cinematographers: [Person] @relationship(type: "CINEMATOGRAPHER_IN", direction: IN)
    archiveFootages: [Person] @relationship(type: "ARCHIVE_FOOTAGE_IN", direction: IN)
    archiveSounds: [Person] @relationship(type: "ARCHIVE_SOUND_IN", direction: IN)
}

Instead of:

type Movie {
    movieId: ID! 
    title: String!
    runtime: Int
    adult: Boolean!
    avgRating: Float
    numVotes: Int
    genres: [Genre] @relationship(type: "IN_GENRE", direction: OUT)
    releasedInYear: [Year] @relationship(type: "RELEASED_IN", direction: OUT)
    selves: [Person] @relationship(type: "SELF_IN", direction: IN)
    directors: [Person] @relationship(type: "DIRECTOR_IN", direction: IN)
    writers: [Person] @relationship(type: "WRITER_IN", direction: IN)
    actors: [Person] @relationship(type: "ACTOR_IN", direction: IN)
    actress: [Person] @relationship(type: "ACTRESS_IN", direction: IN)
    composers: [Person] @relationship(type: "COMPOSER_IN", direction: IN)
    productionDesigners: [Person] @relationship(type: "PRODUCTION_DESIGNER", direction: IN)
    editors: [Person] @relationship(type: "EDITOR_IN", direction: IN)
    cinematographers: [Person] @relationship(type: "CINEMATOGRAPHER_IN", direction: IN)
    archiveFootages: [Person] @relationship(type: "ARCHIVE_FOOTAGE_IN", direction: IN)
    archiveSounds: [Person] @relationship(type: "ARCHIVE_SOUND_IN", direction: IN)
}

Note:

Probably you could use https://highlightjs.org/ for this purpose.

apcj commented 3 years ago

Hi @iamsmkr, will look into this at some point. Thanks for the suggestion.