Skip to content

Instantly share code, notes, and snippets.

@bshelling
Created January 22, 2020 15:48
Show Gist options
  • Save bshelling/a7bb9276b5f516a0120717adac9da42a to your computer and use it in GitHub Desktop.
Save bshelling/a7bb9276b5f516a0120717adac9da42a to your computer and use it in GitHub Desktop.
Markdown - Index.js
/**
* Import markdown file
*/
const chaperOne = require(‘../Chapter_01/chapter01.md’);
/**
* CDN Bootstrap stylesheet
*/
const markdownCss = ‘https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css';
/**
* Create link tag
* Pass markdown variable to link href.
* Set rel to stylesheet
* Set type text/css
*/
const cssStyle = document.createElement(‘link’);
cssStyle.href = markdownCss;
cssStyle.rel = “stylesheet”;
cssStyle.type =”text/css”;
/**
* Append link to head
*/
document.head.appendChild(cssStyle);
/**
* Append chapterOne variable to page inner Html
*/
page = document.getElementById(‘container’);
page.setAttribute(“class”,”container”);
page.innerHTML = chaperOne;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment