From 7c6116b7be5bab807437f4e0e4f4831196e78437 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Fri, 3 May 2024 15:12:09 +0100 Subject: [PATCH 1/3] md_links --- taxonium_component/src/utils/processNextstrain.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/taxonium_component/src/utils/processNextstrain.js b/taxonium_component/src/utils/processNextstrain.js index 5038fe4c..b3de6664 100644 --- a/taxonium_component/src/utils/processNextstrain.js +++ b/taxonium_component/src/utils/processNextstrain.js @@ -428,9 +428,19 @@ async function json_to_tree(json) { config.enabled_by_gisaid = true; } - config.overlay = `

This is a tree extracted from a Nextstrain JSON file, being visualised in Taxonium.

.`; + function markdownToHTML(md) { + // Regular expression to match Markdown links + var markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g; + + // Replace Markdown links with HTML tags + var html = md.replace(markdownLinkRegex, '$1'); + + return html; +} + + config.overlay = `

This is a tree extracted from a Nextstrain JSON file, being visualised in Taxonium.

.`; if (json.meta.description) { - config.overlay = config.overlay + "

" + json.meta.description + "

"; + config.overlay = config.overlay + "

" + markdownToHTML(json.meta.description) + "

"; } if (json.meta && json.meta.updated) { From 500b959ed1cf1d0be955173f1a9c4d29ef1d898e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 14:12:56 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taxonium_component/src/utils/processNextstrain.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/taxonium_component/src/utils/processNextstrain.js b/taxonium_component/src/utils/processNextstrain.js index b3de6664..a26ba900 100644 --- a/taxonium_component/src/utils/processNextstrain.js +++ b/taxonium_component/src/utils/processNextstrain.js @@ -431,16 +431,20 @@ async function json_to_tree(json) { function markdownToHTML(md) { // Regular expression to match Markdown links var markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g; - + // Replace Markdown links with HTML tags - var html = md.replace(markdownLinkRegex, '$1'); - + var html = md.replace( + markdownLinkRegex, + '$1' + ); + return html; -} + } config.overlay = `

This is a tree extracted from a Nextstrain JSON file, being visualised in Taxonium.

.`; if (json.meta.description) { - config.overlay = config.overlay + "

" + markdownToHTML(json.meta.description) + "

"; + config.overlay = + config.overlay + "

" + markdownToHTML(json.meta.description) + "

"; } if (json.meta && json.meta.updated) { From 4c91a1db7993416d33d3e15f594c99b343ae7520 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Fri, 3 May 2024 15:17:33 +0100 Subject: [PATCH 3/3] update --- taxonium_component/src/components/SearchPanel.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/taxonium_component/src/components/SearchPanel.jsx b/taxonium_component/src/components/SearchPanel.jsx index b5aa5343..f7eff11c 100644 --- a/taxonium_component/src/components/SearchPanel.jsx +++ b/taxonium_component/src/components/SearchPanel.jsx @@ -273,7 +273,7 @@ function SearchPanel({ )}

{config.enabled_by_gisaid && ( - + Enabled by data from{" "} .