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

Suggestion for Including Code #998

Open
alfaromartino opened this issue Feb 22, 2023 · 2 comments
Open

Suggestion for Including Code #998

alfaromartino opened this issue Feb 22, 2023 · 2 comments

Comments

@alfaromartino
Copy link

Thanks for this great package!!
I had a suggestion after working for several months with Franklin (actually PkgPage). Everything runs quite smoothly for me, except when it comes to including code. So far, there are two options for doing this: i) introducing code directly into the text, or ii) creating a code file that is eventually called in the text.

I thought that a third option would be valuable: writing a file with ALL scripts to include, with tags to separate them.
MWE
This is how you'd write the code
01

This is how you'd include the code on text
02

This option is especially useful if you've worked on a project and want to create a website explaining the code snippets (or if you wrote code without the intention of creating a website, creating an ideal alternative to Jupyter) More generally, I think it'd also make writing the code more smoothly.

Thanks again for all your work!

@tlienart
Copy link
Owner

tlienart commented Feb 22, 2023

Hello @alfaromartino thanks for the feedback, just to check, are you aware that Franklin does handle literate files (docs: https://franklinjl.org/extras/literate/) and would this kind of address your point of

This option is especially useful if you've worked on a project and want to create a website explaining the code snippets (or if you wrote code without the intention of creating a website, creating an ideal alternative to Jupyter)

As an aside, Franklin.jl is in a frozen state, the new version (currently available at Xranklin.jl) is a complete rewrite and will be the next Franklin version 0.11 (and eventually 1.0) so for now I won't be making any major changes or additions to Franklin.jl 0.10 while that's not in.
On the constructive side, the next version will give you access to the parser and you could define your own parsing rules. In your specific case though, it would be a bit awkward because the # clashes with the tag for header in Markdown.

@alfaromartino
Copy link
Author

I know that it could handle Literate but, since I never used it, I ignored it. It seems that it's what I was describing!!! I'll take a lookn into it. It seems it's not automatic, but it can address this.

I'm aware of Xranklin. The comment was to provide some feedback, just in case it was useful for Xranklin ( the # was just an example, to give a same feeling as the references to headers). In fact, I use PkgPage, and it'd be great if Xranklin could have some package similar to PkgPage!

Thanks for your work!

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

2 participants