Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Md links #589

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion taxonium_component/src/components/SearchPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function SearchPanel({
)}
</p>
{config.enabled_by_gisaid && (
<span>
<span className="text-gray-500 mt-1">
Enabled by data from{" "}
<a
rel="noopener noreferrer"
Expand All @@ -284,6 +284,7 @@ function SearchPanel({
src="https://www.gisaid.org/fileadmin/gisaid/img/schild.png"
alt="gisaid-logo"
width="65"
className="inline-block"
/>
</a>
.
Expand Down
18 changes: 16 additions & 2 deletions taxonium_component/src/utils/processNextstrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,23 @@ async function json_to_tree(json) {
config.enabled_by_gisaid = true;
}

config.overlay = `<p>This is a tree extracted from a <a href='//nextstrain.org'>Nextstrain</a> JSON file, being visualised in Taxonium.</p>.`;
function markdownToHTML(md) {
// Regular expression to match Markdown links
var markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;

// Replace Markdown links with HTML <a> tags
var html = md.replace(
markdownLinkRegex,
'<a class="underline" href="$2">$1</a>'
);

return html;
}

config.overlay = `<p>This is a tree extracted from a <a class='underline' href='//nextstrain.org'>Nextstrain</a> JSON file, being visualised in Taxonium.</p>.`;
if (json.meta.description) {
config.overlay = config.overlay + "<p>" + json.meta.description + "</p>";
config.overlay =
config.overlay + "<p>" + markdownToHTML(json.meta.description) + "</p>";
}

if (json.meta && json.meta.updated) {
Expand Down
Loading