Skip to content

Commit

Permalink
Add showdown to render markdown response as html
Browse files Browse the repository at this point in the history
  • Loading branch information
crpietschmann committed Mar 13, 2024
1 parent 6571df6 commit 80d021d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ <h5><a href="https://build5nines.com" target="_blank"><img src="/images/build5ni

<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/showdown@2.1.0/dist/showdown.min.js"></script>
<script>
$(document).ready(function() {
const messageList = $('#message-list');
Expand Down Expand Up @@ -100,7 +101,11 @@ <h5><a href="https://build5nines.com" target="_blank"><img src="/images/build5ni
}

function formatMessageForDisplay(message) {
return message.replaceAll('\n', '<br/>');
// return message.replaceAll('\n', '<br/>');

var converter = new showdown.Converter(),
html = converter.makeHtml(message);
return html;
}

function sendMessageToApi(message) {
Expand Down

0 comments on commit 80d021d

Please sign in to comment.