Skip to content

Commit

Permalink
Updated Markdown Tag - CommonMark 📝
Browse files Browse the repository at this point in the history
  • Loading branch information
MarketingPip authored Aug 30, 2022
1 parent 7d1fc7f commit 8ebfc33
Showing 1 changed file with 2 additions and 51 deletions.
53 changes: 2 additions & 51 deletions markdown-tag-commonmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var Debug = false;
function renderMarkdown(){

/* Add Github CSS + Syntax Highlight CSS */
/* Add Github CSS */


var CSSAdded = false;
Expand All @@ -28,25 +28,6 @@ function addCss(fileName) {

}



var SyntaxCSSAdded = false;
function addSyntaxHighlightCss(fileName) {

if (SyntaxCSSAdded == false){
var head = document.head;
var link = document.createElement("link");

link.type = "text/css";
link.rel = "stylesheet";
link.href = fileName;

head.appendChild(link);
SyntaxCSSAdded = true

}

}

if (document.getElementsByTagName("md").length > 0) {

Expand All @@ -63,8 +44,7 @@ if (document.getElementsByTagName("github-md").length > 0) {

addCss('https://cdn.jsdelivr.net/gh/MarketingPipeline/Markdown-Elements/stylesheets/github_md.css');

addSyntaxHighlightCss('https://cdn.jsdelivr.net/gh/PrismJS/prism-themes/themes/prism-ghcolors.css')
addSyntaxHighlighter()

var GitHub_MD_TAG = document.getElementsByTagName("github-md");
for(var i=0; i<GitHub_MD_TAG.length; i++)
GitHub_MD_TAG[i].innerHTML = marked.parse(GitHub_MD_TAG[i].innerHTML)
Expand All @@ -74,35 +54,6 @@ GitHub_MD_TAG[i].innerHTML = marked.parse(GitHub_MD_TAG[i].innerHTML)



function addSyntaxHighlighter(){

/// Add Prism.JS to document
var script = document.createElement('script');
script.src = "https://cdn.jsdelivr.net/npm/prismjs@1.28.0/prism.min.js";

document.head.appendChild(script);




// On Error Loading Markdown Parser
script.onerror = function () {

console.error("Markdown Tag: Error while performing function addSyntaxHighlighter - There was an error loading the Syntax Highlighter");

}


/// Markdown Parser Load Successful
script.onload = function () {

if (Debug == true){
console.log("Syntax Highlighter Was Loaded")
}


};
}


function loadMarkdownParser(){
Expand Down

0 comments on commit 8ebfc33

Please sign in to comment.