Skip to content
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

Code formatting #67

Open
StenSeegel opened this issue May 8, 2024 · 1 comment · Fixed by #82
Open

Code formatting #67

StenSeegel opened this issue May 8, 2024 · 1 comment · Fixed by #82

Comments

@StenSeegel
Copy link
Contributor

StenSeegel commented May 8, 2024

When you request code from gpt, it returns the code in markdown format, which is then formatted and styled with css.
The problem here is that when copying & pasting code in HAWKI, the first line indicating the programming language is always copied to the clipboard. In the chatGPT UI this line is excluded from the clipboard.
I got feedback from users in tech that this is annoying because you can't paste the clipboard content directly into terminal apps ect. and need to remove this first line manually.

My suggestion is to modify the highlight function to exclude the first line. As seen in the ChatGPT UI, the first line is also excluded from the code:
Bildschirmfoto 2024-04-18 um 14 02 36

The following is the plain text output from OpenAI Playground (I had to include the > signs to prevent the editor from generating a markdown formatting error):

Eine "Hello World" Nachricht in Python zu erstellen ist sehr einfach. Hier ist ein Beispiel dafür, wie man es macht:

>```python
>print("Hello World")
>```

Dieser Code benutzt die Funktion `print()`, um den Text "Hello World" in der Konsole oder im Terminal auszugeben. Du kannst diesen Code in jeder Python-Entwicklungsumgebung oder direkt im Python-Interpreter ausführen.

The screenshot shows how it's rendered in HAWKI, the pasted clipboard content is highlighted in the input field.

Bildschirmfoto 2024-05-08 um 14 52 36
@ShUl0w
Copy link
Contributor

ShUl0w commented Aug 8, 2024

Hi @StenSeegel ,

I've opened a PR with your proposed changes, see #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants