-
-
Notifications
You must be signed in to change notification settings - Fork 96
-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Use Jekyll/Liquid include for images/figures instead of Markdown #161
Comments
Can Kramdown parse these includes to give us a list of figures? If not, how will we regenerate |
Jekyll uses Liquid for all the tags. We could change https://github.com/swcarpentry/lesson-example/blob/gh-pages/bin/markdown_ast.rb to do the tag processing replacement, see |
I usually deal with this in a liquid loop.
Forgive me if I'm misunderstanding something, but isn't this what you're looking for ? |
@brucellino we don't keep a list of figures on any file because if authors need to edit more than one place we have a point of failure on our workflow. For that reason, we need a script to collect all the figures "in the correct order". |
Ok (sorry for barging in on this - I thought I had a good suggestion !). So, if I understand it correctly, you just want to be able to have the added features by including an image template ( |
Because this is error prone in the long run. Is the same reason why programmers write functions instead of duplicate code, if they need to change something they only need to change once. And as we need to eat our own dog food, using the template is the correct way. To give you a better example, if today we use CSS framework X and our HTML need to be
but tomorrow we use framework Y and our HTML need to be
we only need to make the change in one place, the template, instead of going in all the files looking for where we need to make the change. |
Just to clarify @gvwilson, currently the We can reproduce the all_figures page with Liquid, including getting images in the correct order, by replacing
I like this sort of solution because it relies on one less python file, and is part of the Jekyll build process which makes development easier. It would work with both the current standard markdown images and with @rgaiacs figure include (assuming the |
@evanwill Thanks for your feedback.
We can't use your code snippet because, as you mention on your comment, it will fail when we have
which is a valid HTML code. This is the main reason that we are using the abstract syntax tree (AST) provided by kramdown, the same parser used by Jekyll. Since most of the comments to my proposal so far diverted to the "List of Figures", I created another proposal, see #162, to discuss it. |
I think this needs a cost-benefit analysis. Markdown is easy to write. It's what we currently use and it works fine. While image captions might be useful in some places, I don't feel that learning the new syntax and changing all the code is worth while. Some images will probably get missed or not work properly and someone will have to fix it. |
@rgaiacs actually my Liquid snippet above will catch your figure include, even with the extra white space, since Liquid is looking at the
And use it in a page like: It will render without the extra white space, like:
Also, if the user writes some non-standard img tags into a markdown episode, it will still catch it, because kramdown normalizes the white space and tags. My take is that a Jekyll project is a closed loop. You create the includes and set a few conventions, you don't need to parse for every possibility. By adding a |
@evanwill Thanks very much for all the clarification. 💖 |
ha ha, actually didn't mean to strongly argue for it, but I am working on some jekyll projects right now and have a sort of crush on Liquid. In any case, I agree that having a |
I'm -1 on this. Anything that deviates from Markdown syntax makes contributing more difficult, and reduces interoperability of the content. |
After talk with other instructions we will merge this after a review of https://github.com/swcarpentry/styles/blob/gh-pages/bin/lesson_check.py and the documentation. |
At the moment we are using "standard" Markdown syntax to include images/figures. Markdown syntax lacks some features such as caption. I want to propose we start using Jekyll/Liquid include for the next release.
Current behaviour
Propose behaviour
Required parameters
filename
alternative_text
Optional parameters
caption
license
, preferable CC-BYsource_url
, for any content that we didn't authoredBackward compatibility
This will not break backward compatibility. Any lesson that didn't migrate to use include will not see any difference.
The text was updated successfully, but these errors were encountered: