Feel free to close if this is not a bug (or bug of some other library).
I'm trying to render the following
```
python command subdir=\${model.nb_layers}
```
but it crashes because MDX tries to evaluate the contents of the ${...}. I suspect some double escaping occurs and the problem (if indeed a problem) lies in this line. Or it could be a remark issue. Not entirely sure which.
I also posted on Spectrum here because I wasn't sure whether this was a bug.
@mdx-js/[email protected]Repo here - https://github.com/yangshun/hydra/blame/master/website/docs/configure_hydra/workdir.md#L67-L69
Renders fine. It renders ok for GFM.
MDX tries to evaluate the contents of the ${...}. I suspect some double escaping occurs.
It is escaping
```
python command subdir=\${model.nb_layers}
```
results in
/* @jsx mdx */
const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope")
return <div {...props}/>
};
const layoutProps = {
};
const MDXLayout = "wrapper"
function MDXContent({
components,
...props
}) {
return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
<pre><code parentName="pre" {...{}}>{`python command subdir=\\${model.nb_layers}
`}</code></pre>
</MDXLayout>;
}
;
MDXContent.isMDXComponent = true;
while
```
python command subdir=${model.nb_layers}
```
results in
/* @jsx mdx */
const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope")
return <div {...props}/>
};
const layoutProps = {
};
const MDXLayout = "wrapper"
function MDXContent({
components,
...props
}) {
return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
<pre><code parentName="pre" {...{}}>{`python command subdir=\${model.nb_layers}
`}</code></pre>
</MDXLayout>;
}
;
MDXContent.isMDXComponent = true;
The question is, should it?
From the ongoing discussion at https://github.com/mdx-js/mdx/issues/628, maybe?
Interpolated content can be interleaved in markdown, this is one edge cases that can happen with interleaving.
@ChristianMurphy to be clear, I want to render the \ also - I also tried \\\${...} but it becomes \\\\${...} and \ escapes the \ in front of the $.
@ChristianMurphy, the desired output to show to the user \${model.nb_layers} in a code block.
(Just like GitHub is rendering it now).
The escaping before the $ is a part of the documentation.
Thanks for the clarification @yangshun and @omry!
That makes sense, PRs are welcome!
I placed a $100 bounty for the person whose pull request for fixing this issue gets merged. Add to or claim the bounty here https://www.bountysource.com/issues/86803859-unable-to-render-in-code-block.
I created PR #991 for fix this. Take a look please.
@lex111 awesome and nice to see that you are going after it. As far as the PR goes I cannot judge it so we/you are at the mercy of the mdx crew. I have subscribed to the PR so I will keep an eye on it 馃
Most helpful comment
I placed a $100 bounty for the person whose pull request for fixing this issue gets merged. Add to or claim the bounty here https://www.bountysource.com/issues/86803859-unable-to-render-in-code-block.