Skip to content

Condtionally show markdown #1987

Answered by dkrasne
kylehodgson asked this question in Q&A
Discussion options

You must be logged in to vote

Here's what I did in a similar situation:

I created a constant ternary variable (somewhat like you've done, but inside a js block), and I just assigned it null if the length was zero (and assigned it a plot to display, otherwise). (It's called plotDisplay if you want to search the page for it.) Then I wrote an if statement that selected between two different display() statements:

if (!plotDisplay) {
	display(html`<p>Based on information currently in the database, there are no intertexts in the specified passage.</p>`)
} else {

display(html`<fairly long HTML page here>`)

Hopefully that helps!

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Fil
Comment options

Fil Jun 2, 2025
Collaborator

Answer selected by Fil
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants