Skip to content

Using [the MDX playground](https://mdxjs.com/playground/), I entered: #2666

@rakelmaia9-dot

Description

@rakelmaia9-dot

Using the MDX playground, I entered:

<pre><code>{`01234
    abcd`}</code></pre>

Looking at the compiled code, I see:

function _createMdxContent(props) {
  return <pre><code>{`01234
  abcd`}</code></pre>;
}

Notably, the template literal string now has only two spaces before abcd compared to the four it started with and I want. This isn't the usual behavior of template literals.

I'm working around this for now by replacing my spaces with non-breaking spaces, which aren't removed.


Zooming out a bit, I have a custom component for the pre tag which comes into play when I am writing fenced code blocks. In this case, I want to pass some additional arguments to the component, but I can't figure out how to do that other than directly invoking the component. That is, I wish I could do something like:

```my-language additional-argument="1"
cool
    stuff here
```

Instead I've been calling the component directly using a template string to get newlines:

<MyFormatting language="my-language" additional-argument="1">{`cool
    stuff here`}</MyFormatting>

Is there any syntax I've missed to pass additional arguments to the fenced code block?

Originally posted by @shepmaster in #2588

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions