Comments (2)
When HTSD installs slides, it wraps elements inside the <body>
tag into <div>
s. The <hr>
tag marks the beginning of the next slide. This behavior is designed for html files generated from Markdown files in mind.
I don't know how you've generated or written the html file in which you want to install HTSD, but maybe creating html elements dynamically is an option for you. If so, then you can proceed as follows:
- Add a template tag somewhere in the html document
- Embed the HTSD script into the document with the
data-manual
attribute (this prevents the automatic installation of slides) - Add a script that installs HTSD slides manually and inserts new elements into the document based on the contents of the template
For example, you can append the following in the end of a Markdown document:
<script type="text/javascript" src="htsd.min.js" data-manual></script>
<script type="text/template" id="my-template">
<div>hidden content</div>
</script>
<script type="text/javascript">
window.htsd.installAll()
const templateStr = document.getElementById("my-template").innerText.trim()
const templateNode = document.createElement("template")
templateNode.innerHTML = templateStr
document.querySelector("body").appendChild(templateNode.content.firstChild)
</script>
Once you load that, you should see that <div>hidden content</div>
is the last child element of <body>
.
Also, you can replace <script type="text/template" id="my-template">
with <template id="my-template">
, giving you a document fragment ready to be used. That would allow omitting the document.createElement("template")
call in step 3. Unfortunately, the marked
Markdown compiler wraps a <template>
tag within a <p>
tag.
from hackers-tiny-slide-deck.
Thank you for the quick and helpful response tkareine
from hackers-tiny-slide-deck.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hackers-tiny-slide-deck.