Skip to content

Conversation

mgroeber9110
Copy link
Contributor

This modifies the rules for "Markdownish" formatting in the server's front-end to only replace formatting characters (like '_' and '*') and headings outside of code sections.

This keeps the formatter from messing up Python comments (# comment) and function names with underscores in code examples (my_example_function()).

The idea of the regex follows the accepted answer here: https://stackoverflow.com/questions/6462578/regex-to-match-all-instances-not-inside-quotes - only perform the replacement if it is followed by an even number of backquotes. This is still not perfect for truncated or invalid Markdown, and it only applies the correct formatting once the code section is closed, but at least it fixes some straightforward cases of code rendering.

@mgroeber9110 mgroeber9110 changed the title Server: do not apply Markdown formatting in code sections Server front-end: do not apply Markdown formatting in code sections Apr 23, 2024
@ggerganov ggerganov merged commit 3fe847b into ggml-org:master Apr 24, 2024
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 this pull request may close these issues.

2 participants