MaxLeiter / Drift

Drift is a self-hostable Gist and paste service. Built with Next.js 13 and React Server Components.
https://drift.lol
MIT License
1.36k stars 61 forks source link

Display after saving and more syntax highlighting #115

Open XeroxDev opened 2 years ago

XeroxDev commented 2 years ago

Describe the bug I noticed that uploaded files are no longer displayed correctly. No syntax highlighting and no more new lines.

I also noticed the syntax highlighting isn't that good overall. Some languages are not supported entirely (CSharp) and others have just two colors (js, json). Would be nice if the syntax highlighting is like in github.

To Reproduce Steps to reproduce the behavior:

  1. Upload a file (I've tested it with a simple hello world c# file)
  2. save it

Expected behavior Preview should display it correctly. (Syntax highlighting, new lines and so on)

Screenshots CSharp File (Preview) image CSharpFile (RAW) image Json File (Preview) image Json File (RAW) image

Desktop (please complete the following information):

Additional context Code to copy

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, world!");
            Console.ReadLine();
        }
    }
}
{
  "Hello": "World",
  "Integer": 123.45,
  "BoolTrue": true,
  "BoolFalse": false
}
XeroxDev commented 2 years ago

bump

MaxLeiter commented 2 years ago

I'm currently in the process of refactoring Drift and improved highlighting is one of my goals. It's an easy fix -- the current code strips out styles because I intended to add them on the client.