본문 바로가기

티스토리 - markdown & mathjax(수학수식) 적용.

web by 낼스 2019. 1. 30.

<link type="text/css" rel="stylesheet" href="./images/markdown.css">
<style>
.MJXp-math.MJXp-display, .MJXc-display {
  display:inline !important;
}
</style>
<!--
<link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css">
-->

<script type="text/javascript" src="https://rawgit.com/softm/loader/master/loader.js"></script>
<!--

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
  , skipTags: ["script","noscript","style","textarea","pre","code"]
    ,ignoreClass:"javascript|language-javascript|hljs"
    , delimiters: [['$','$']]
});
//       " delimiters: [['`','`'], ['$','$']]""     ```javascript 때문에 제외.
</script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' async></script>
-->
            <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML' async></script>

    <script type="text/javascript">
        if ( document.getElementsByClassName("markdown-body").length > 0 ) document.getElementsByClassName("markdown-body")[0].style.display="none";
    window.onload = function () {
        if ( document.getElementsByClassName("markdown-body").length > 0 ) {

        loader.js(
            [
                "https://cdnjs.cloudflare.com/ajax/libs/showdown/1.8.6/showdown.min.js",
                "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js",
                "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"
            ],
            [
              function(e) {
                console.log("1st",e);
              },
              function(e) {
                console.log("2nd",e);
              },
              function(e) {
                console.log("3rd",e);


                var containers = document.querySelectorAll(".markdown-body");


                //var containers = [container];
                var sd = new showdown.Converter();
                for (var i = 0; i < containers.length; i++) {


                        containers[i].innerHTML = sd.makeHtml(containers[i].innerHTML);
                    var codes = containers[i].querySelectorAll("pre code");
    /*
                    codes.forEach(function(code) {
                        hljs.highlightBlock(code);
                    });
    */
/* unused window.setTimeout( function() {												
(function () {
  var head = document.getElementsByTagName("head")[0], script;
  script = document.createElement("script");
  script.type = "text/x-mathjax-config";
  script[(window.opera ? "innerHTML" : "text")] =
    "MathJax.Hub.Config({\n" +
    "  tex2jax: { inlineMath: [['$','$'], ['\\\\(','\\\\)']] },\n" +
    '  skipTags: ["script","noscript","style","textarea","pre","code"],\n' + 
		' ignoreClass:"javascript|language-javascript|hljs",\n'	+
		 " delimiters: [['$','$']]" + 
//		 " delimiters: [['`','`'], ['$','$']]""		```javascript 때문에 제외. 
    "});";
  head.appendChild(script);
  script = document.createElement("script");
  script.type = "text/javascript";
  script.src  = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML";
  head.appendChild(script);
})();	
},1000);*/


                    for(var j=0;j<codes.length;j++) {
                        var code = codes[j];
                             hljs.highlightBlock(code);
                    }

                }
                                                    document.getElementsByClassName("markdown-body")[0].style.display="block";

              }
            ],
            false // default false
        );
      }
    }
    </script>



'web' 카테고리의 다른 글

Selenium 을 이용한 Web 어플리케이션 테스트 자동화  (0) 2019.01.30
gen coding  (0) 2019.01.30
security.fileuri.strict_origin_policy  (0) 2015.10.12
firefoxs_file_uri_origin_policy_and_web_fonts  (0) 2015.10.12
Using CORS  (0) 2015.10.08

댓글