Giter Site home page Giter Site logo

include-code-files's People

Contributors

cderv avatar jjallaire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

include-code-files's Issues

whitespace is meaningful

This example document contains two "include" instances; the first instance includes the referenced file as expected. The second instance adds the {.yaml include = "stuff.yml"} text in the document.

---
title: includes
filters:
  - include-code-files
---

```{.yaml include="stuff.yml"}
```

```{.yaml include = "stuff.yml"}
```

I ended up with whitespace surrounding the equals sign because I was trying to adapt some of the knitr embed/verbatim examples; those use whitespace.

Renders as:

image

Using Quarto 1.2.335.

install fails on Mac OS x

I'm not sure what I'm supposed to be doing but the instructions as given on the README.md don't work for me.

~/github/bob-carpenter/stan-getting-started (main)$ quarto add quarto-ext/include-code-files


Quarto extensions may execute code when documents are rendered. If you do not 
trust the authors of the extension, we recommend that you do not install or 
use the extension.
 ? Do you trust the authors of this extension (Y/n) › Yes
[✓] Downloading
[✓] Unzipping
    Found 1 extension.

The following changes will be made:
Include Code Files   [Install]   1.0.0 (filter)
 ? Would you like to continue (Y/n) › Yes

[✓] Extension installation complete.
Learn more about this extension at https://www.github.com/quarto-ext/include-code-files

And then I put this in my Yaml:

filters:
    - include-code-filters

and then I run and it fails with this message when doing the final rendering:

Error running filter /Applications/quarto/share/filters/main.lua:
Error running filter /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-filters:
Could not find executable /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-filters
stack traceback:
	/Applications/quarto/share/filters/main.lua:4026: in function </Applications/quarto/share/filters/main.lua:4005>
	[C]: in ?
	[C]: in method 'walk'
	/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
	/Applications/quarto/share/filters/main.lua:449: in local 'callback'
	/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
stack traceback:
	/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
	/Applications/quarto/share/filters/main.lua:449: in local 'callback'
	/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
make: *** [stan-getting-started.pdf] Error 1

After I run the install, I can't find the include-code-filters anywhere on my OS.

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

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.

Feature request - snippet mode

This is a great filter, thank you! I saw in the docs for the pandoc-include-code filter you've cited for inspiration that they have a snippet-mode feature, as well, so the line numbers in the referenced code can change without breaking the reference in the docs:

// start snippet wow
int main() {
    printf("such performance");
}
// end snippet wow

This would be a great feature to enable in this extension. I'd offer to develop it myself, but I have no experience with Lua whatsoever. Thanks again for this extension, it's very useful as is.

Line numbers in MS word rendering

Hi there,

Currently line numbers is not supported in MS word output. Will it be possible to show line numbers in word?
Word:
image

HTML:
image

Thanks!

How to evaluate `include` argument?

Sometimes it's easier to construct the path to a file in code, for example:
model_path = here::here("my-code-file.stan")
in a quarto document.

Is it possible to have the include argument of a chunk evaluated?

```{.stan include=model_path}
```

doesn't appear to evaluate the variable model_path correctly. Is there a syntax option to have this variable get evaluated to return the file path, and then have the path parsed correctly as normal?

Path to include code file differs depending on output format e.g. HTML or PDF

I figures out some more details and according to your request from here quarto-dev/quarto-cli#4340 (comment) I will open this issue:

To get code highlighting in HTML AND PDF I have to include the code file with different path:
`
::: {.content-visible when-format="html"}
```{.c include="../code/test.c"}
```
:::

::: {.content-visible when-format="pdf"}
```{.c include="./code/test.c"}
```
:::
`
On this way I get the code highlighting in html and pdf.
I attached the complete test project.
GBSSG_Skripte_030_Physik.zip

Quarto Version: 1.2.334 with installed include-code-files extension.

Thank you very much for your help
regards
Mike

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.