-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: syntax highlighting using chroma #1
Conversation
elianiva
commented
Oct 5, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little bit more
highlighted, err := h.Highlight(content, qs.Language, qs.Theme, qs.LineNr) | ||
if err != nil { | ||
// they should still be able to get the plain text even if the highlighter is b0rked | ||
c.Status(http.StatusOK).Send([]byte(content)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's error, just return err
, no need to make a StatusOK
response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kalo highlighternya doang yg error, masa ga ditampilin meskipun ga pake highlight?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kemungkinan highlighternya error gara-gara apa?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gagal tokenise atau formatter gagal ngehasilin output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oke. tetep aja ga ideal. tapi aku benerin nantian
@@ -58,13 +58,18 @@ func (d *Dependency) Get(c *fiber.Ctx) error { | |||
// we need to replace escaped newline to literal newline | |||
content := strings.Replace(i.Paste, `\n`, "\n", -1) | |||
|
|||
c.Set("Content-Type", "text/plain") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Content-Type
headers will be set twice when qs.Language
is not empty if you put it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alasan kenapa ditaruh disini relate sama ini #1 (comment), awalnya biar ga perlu copas, yowes lah