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

Improve include #88

Closed
rikhuijzer opened this issue Apr 13, 2021 · 3 comments · Fixed by #118
Closed

Improve include #88

rikhuijzer opened this issue Apr 13, 2021 · 3 comments · Fixed by #118
Labels
enhancement New feature or request

Comments

@rikhuijzer
Copy link
Collaborator

When inserting dynamic content via

```{.include}
_gen/foo.md
```

the output will always have spacing around it.
This is inconvenient when you would like to write something like "This project is built with Julia $(version)" or to report a statistic like "the mean is $(mean_x).

So, this can be improved in two ways:

  1. Allow include without spacing around it. This would look bad in the markdown, but good in the end-result
  2. Allow in-line includes like presented above $(version).
@rikhuijzer rikhuijzer added the enhancement New feature or request label Apr 28, 2021
@rikhuijzer
Copy link
Collaborator Author

rikhuijzer commented Jun 18, 2021

It's probably time to create a proper lua filter which converts statements like foo (even inline) to _gen/foo.md.

Also, it should support arguments, so that var("a") would give as output 1 when a user defines:

function var(s::String)
    d = Dict(
        "a" => 1
        "b" => 2
    )
    d[s]
end

This could even support accessing objects inside the module, because the text is just parsed. I should ensure that " is converted to something like %22 in the filename.

@rikhuijzer
Copy link
Collaborator Author

If functions can be called, this basically yields the same possibilities as Bookdown, because

```gen
cb(function_name; output=false)
```

is similar to

```{r, echo=FALSE}
function_name()
```

@rikhuijzer
Copy link
Collaborator Author

rikhuijzer commented Jun 19, 2021

It appears that

`jl foo()` 

can only contain inline elements, so no full Markdown document can be parsed. That's okay, I guess. It will just put text there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant