Closed ege0zcan closed 1 month ago
Had an offline discussion with @dogusata about this. Although this solution works, it introduces some additional computation that needs to be done by the regex and then the sorting. We decided to update the logic in mynah-ui to let mynah handle codeblocks by using the ~~~
syntax for codeblocks
Problem
Right now the way we create markdown code blocks for
send to prompt
is a bit too naive and is prone to breaking when a user selection contains backticks. See for example:Solution
To overcome this, we can implement a function that finds the longest backtick sequence inside a provided user selection and then creates the markdown code block with more backticks than that amount
This has the small caveat that codeblocks with backticks will now consume more of the character limit
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.