Skip to content

Commit

Permalink
Remove debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
Gawdl3y committed Jun 11, 2024
1 parent 74c229d commit ac1c90a
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions ui/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@ export const REPO_URL = `${GITHUB_URL}/Gawdl3y/Resolute`;
* @param {string} markdown
* @returns {string}
*/
export function renderMarkdown(markdown) {
// Replace git hashes with Markdown links
markdown = markdown.replace(
/(\b|\(|\[\{)(([0-9a-f]{7})([0-9a-f]{1,33})?)\b/g,
`$1[$3](${REPO_URL}/commit/$2)`,
);
export function renderMarkdown(markdown, github = true) {
if (github) {
// Replace git hashes with Markdown links
markdown = markdown.replace(
/(\b|\(|\[\{)(([0-9a-f]{7})([0-9a-f]{1,33})?)\b/g,
`$1[$3](${REPO_URL}/commit/$2)`,
);

// Replace issue numbers with Markdown links
markdown = markdown.replace(
/(\s|\(|\[\{)#([0-9]+)\b/g,
`$1[#$2](${REPO_URL}/issues/$2)`,
);
// Replace issue numbers with Markdown links
markdown = markdown.replace(
/(\s|\(|\[\{)#([0-9]+)\b/g,
`$1[#$2](${REPO_URL}/issues/$2)`,
);

// Replace GitHub username mentions with Markdown links
markdown = markdown.replace(
/(\s|\(|\[\{)@([a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38})\b/gi,
`$1[@$2](${GITHUB_URL}/$2)`,
);
// Replace GitHub username mentions with Markdown links
markdown = markdown.replace(
/(\s|\(|\[\{)@([a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38})\b/gi,
`$1[@$2](${GITHUB_URL}/$2)`,
);
}

// Set up the marked renderer to make links open in a new window
const renderer = new marked.Renderer();
Expand Down

0 comments on commit ac1c90a

Please sign in to comment.