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

collapse buttons not working #45

Open
thibautjombart opened this issue Oct 26, 2018 · 8 comments
Open

collapse buttons not working #45

thibautjombart opened this issue Oct 26, 2018 · 8 comments
Labels

Comments

@thibautjombart
Copy link
Contributor

thibautjombart commented Oct 26, 2018

@zkamvar @maelle @stephlocke
Right, so I start to have a better idea of what is happening on this.

Context

I am using this kind of buttons in a new case study:
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_collapsible&stacked=h

The issue

They work well when using rmarkdown::render("foo_Rmd"), but not when rendered on the website; I have added the headers of the example above to layout/partials/head.html, so the issue doesn't seem to come from there. If we look at the source file content/post/test-buttons.Rmd:

---
title: "Test collapse button"
author: "Thibaut Jombart"
authors: "Thibaut Jombart"
date: 2018-10-24
licenses: CC-BY
categories: "case study"
slug: button-test
image: img/highres/graduation-1965.jpg
showonlyimage: true
---


Here is an attempt at collapse button, taken from:
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_collapsible&stacked=h


<div class="container">
  <h2>Simple Collapsible</h2>
  <p>Click on the button to toggle between showing and hiding content.</p>
  <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
  <div id="demo" class="collapse">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </div>
</div>

After using learn::render_new_rmds_to_md(), the file content/post/test-buttons.md looks like:

Here is an attempt at collapse button, taken from: <https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_collapsible&stacked=h>

<h2>
Simple Collapsible
</h2>
<p>
Click on the button to toggle between showing and hiding content.
</p>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">
Simple collapsible
</button>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

The

tags have been stripped out. If I put them back in, then the page renders just fine.

I can foresee more problems ahead if <div> tags are removed from our Rmd. Any thoughts / idea welcome.

Resources

Files are here:
5f05b32

@thibautjombart
Copy link
Contributor Author

@dirkschumacher this may be relevant to you too for the MSF work if case studies are to end up on reconlearn.org

@stephlocke
Copy link
Contributor

Dumb Q but if you don't do any indenting of the lorem ipsum code does it work? I'm thinking about 4 space code indenting

@zkamvar
Copy link
Member

zkamvar commented Oct 26, 2018

Dumb Q but if you don't do any indenting of the lorem ipsum code does it work? I'm thinking about 4 space code indenting

I'll check it out!

@zkamvar
Copy link
Member

zkamvar commented Oct 26, 2018

@stephlocke, it did not do anything different:

image

zkamvar added a commit that referenced this issue Oct 26, 2018
zkamvar added a commit that referenced this issue Oct 26, 2018
@zkamvar
Copy link
Member

zkamvar commented Oct 26, 2018

The problem was that pandoc had deprecated markdown_github in favor or gfm. I updated the learn package in dc1d64e and rendered the documents in b1fb96b and they work!

https://deploy-preview-44--reconlearn-test.netlify.com/post/button-test.html

@zkamvar
Copy link
Member

zkamvar commented Oct 26, 2018

The collapsing works, but at the cost of the inability to render markdown inside it... which is a non-starter.

@stephlocke
Copy link
Contributor

It'll be better to make a hugo shortcode for this capability than write your html each time so that you can get markdown content etc

https://gohugo.io/content-management/shortcodes/

@zkamvar
Copy link
Member

zkamvar commented Oct 26, 2018

I hadn't thought of that!
In our case, we may need to create separate shortcodes for collapsible div and button.

@zkamvar zkamvar mentioned this issue Oct 29, 2018
@zkamvar zkamvar added wontfix and removed bug labels Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants