Skip to content

codefilename not shown anymore for md output #5112

@cderv

Description

@cderv
---
title: foo
format: commonmark
keep-md: true
---

```{.python filename="matplotlib.py"}
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```

This outputs with latest 1.3

# foo

``` python
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```

but it outputs with latest 1.2 release

foo
================

<div class="code-with-filename">

**matplotlib.py**

``` python
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```

</div>

It was lost in https://github.com/quarto-dev/quarto-cli/pull/4118/files#diff-3c9439f2bc27c905f44644b44dee252c2d2729b5da73484cbfc22e814137f98d while introducing DecoratedCodeBlock I believe.

@cscheid is it a regression on purpose ? Or could we port back the old behavior ?

Previously we did

    return pandoc.Div(
      { pandoc.Plain{pandoc.Strong{pandoc.Str(filename)}}, el:clone() },
      pandoc.Attr("", {"code-with-filename"})
    )

for non HTML format and now we just return the content of the code block

else
-- return the code block unadorned
-- this probably could be improved
return el

(from a discussion in #5101)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingregressionFunctionality that used to work but now is broken.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions