Language identifier is missing from fenced code block when it is quoted

Someone can write something like this:

```py
print()
```

But when you then quote its output:

print()

it will be quoted without the language identifier, like this:

print()

Specifically, I noticed this in https://forum.typst.app, and not only me. This is quite annoying to fix manually every time, so I’m pretty confident that this is a bug. Preserving the language identifier is the expected behavior.

4 Likes

Here is a live example of how the code block is quoted (without language identifier).

2 Likes

Today I found out that you can actually get the info string by checking the HTML:

<code class="lang-py hljs language-python" data-highlighted="yes">
  <span class="hljs-built_in">print</span>
  ()
</code>

If the language is known(?), it looks like it will show full name in language-x, but your specified in lang-x. However, even though Python is identified (visually), both classes will include Python.

This will help know which info string is used by someone else, or any post that you can’t edit (or can).

You mean when you quote with text selection right? Using the full quote button work just fine.

That is the expected behavior, as when you select text we don’t have access to the original markdown and do an approximation.

Same as reported in

Yes.

There is no “Full quote” button.

Can you not get the exact place in DOM where the selection is happening? Then it should be pretty easy to replicate whatever is needed.