Skip to content

collapse buttons not working #45

Description

@thibautjombart

@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions