Skip to content

Parametrised markdown code blocks? #2288

Answered by remcohaszing
ilg-ul asked this question in Q&A
Discussion options

You must be logged in to vote

You seem to be coming from a text templating language. It converts text to other text based on interpolation. Any text can be interpolated anywhere in the document, because the content doesn’t have semantic meaning to the templating engine.

MDX is a programming language that gets compiled to JavaScript. It has certain rules of what is valid syntax, and where JavaScript expressions are allowed.

You can write dynamic links for instance in MDX, but you’ll have to use JSX syntax for that, not interpolation:

{/* This is a link to { props.link } */}
[Click me]({ props.link })

{/* This is a link to whatever link is passed as the link prop */}
<a href={props.link}>Click me</a>

Likewise, code blo…

Replies: 8 comments 34 replies

Comment options

You must be logged in to vote
2 replies
@ilg-ul
Comment options

@wooorm
Comment options

Comment options

You must be logged in to vote
12 replies
@remcohaszing
Comment options

@ilg-ul
Comment options

@wooorm
Comment options

@ilg-ul
Comment options

@wooorm
Comment options

Comment options

You must be logged in to vote
2 replies
@wooorm
Comment options

@ilg-ul
Comment options

Comment options

You must be logged in to vote
4 replies
@wooorm
Comment options

@ilg-ul
Comment options

@wooorm
Comment options

@ilg-ul
Comment options

Comment options

You must be logged in to vote
7 replies
@ilg-ul
Comment options

@wooorm
Comment options

@ilg-ul
Comment options

@remcohaszing
Comment options

Answer selected by ilg-ul
@wooorm
Comment options

@ilg-ul
Comment options

Comment options

You must be logged in to vote
7 replies
@wooorm
Comment options

@brillout
Comment options

@wooorm
Comment options

@brillout
Comment options

@wooorm
Comment options

Comment options

You must be logged in to vote
0 replies
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
5 participants