Skip to content

code-fold: true is not working for the chunk with included code from external script #1

Open

Description

@shafayetShafee

While this filter does include codes from an External file, code-fold: true or code-summary: "some text" is not working for that code chunk (that includes the source code). A quick reproducible example is as follows,

test.py

# code from test.py
for name in ["Sam", "Jake"]:
    print(f"Hello {name}!")

test.qmd

---
title: "Including Code"
format:
  html:
    code-fold: true
    code-summary: "Python Code"
jupyter: python3
filters: 
  - include-code-files
---

## Python

```{.python include="test.py"}
```

```{python}
print("Hello World")
```

output

image

I am using Quarto version,

$ quarto --version
1.2.235

Thanks.

Activity

  1. ProtossGP32 commented on Feb 2, 2023

    @ProtossGP32

    Facing the same problem here. It would be great if the extension was compatible with code-folding as some files can be very long.

  2. shafayetShafee commented on Feb 3, 2023

    @shafayetShafee
    Author

    I have created the filter include-code-files extending this filter include-code-files by @quarto-ext, so that included code blocks can be folded with code-fold: true and also provided an option so that filename works fine along with code-folding.

  3. cderv commented on Feb 6, 2023

    @cderv
    Contributor

    @shafayetShafee that is cool !

    do you want /plan to make PR into this extension or rather keep your modification in another extension with the same name ?

    We welcome any contribution by the community, especially in our extension as we don't have as much time to spend on it when we are focusing on quarto-cli core development.

  4. shafayetShafee commented on Feb 6, 2023

    @shafayetShafee
    Author

    I have already implemented my changes as another extension with the same name include-code-files and made an PR to quarto-web repo to enlist this extension the name add-code-files.

  5. cderv commented on Feb 27, 2023

    @cderv
    Contributor

    I'll keep this open for now as I think this extension should support that directly at some point.

  6. reopened this on Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions