Skip to content

Commit

Permalink
Formatted Code String
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Wentzel committed Sep 12, 2024
1 parent 89890a2 commit b654c8f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions assets/js/Containers/FrevaGPT/CodeBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import { Accordion } from 'react-bootstrap';
import PropTypes from "prop-types";

function formatCode(codeString) {
const seperatedCode = codeString[0].split("\\n");
return seperatedCode;
// remove everyting before json codeblock
let newString = codeString[0].slice(codeString[0].indexOf(":") + 2);
newString = newString.slice(0, -2);

const codeSnippets = newString.split("\\n");

return codeSnippets;
}

function CodeBlock(props) {
Expand Down

0 comments on commit b654c8f

Please sign in to comment.