Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shafayetShafee opened this issue Jan 25, 2023 · 5 comments

Comments

@shafayetShafee
Copy link

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.

@ProtossGP32
Copy link

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

@shafayetShafee
Copy link
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.

@cderv
Copy link
Contributor

cderv commented Feb 6, 2023

@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.

@shafayetShafee
Copy link
Author

shafayetShafee commented Feb 6, 2023

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.

@cderv
Copy link
Contributor

cderv commented Feb 27, 2023

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

@cderv cderv reopened this Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants