2017-01-12 10 views
4

マークダウンファイルの生の内容をHTMLに含めるには(軽量な方法が好ましい)markdownファイルの内容をremark.jsのHTMLに含めます

私はスライドショーを作成するためにremark.jsを使用していると私はHTMLは非常に単純である(変化しない)ように、HTMLとは別のマークダウンファイルを維持したいと思います:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8" /> 
    <title>Test</title> 
    <link rel="stylesheet" href="style.css"> 
    <script src="https://gnab.github.io/remark/downloads/remark-latest.min.js"></script> 
    </head> 
    <body> 
    <textarea id="source"> 
     >>'paste' markdown file test.md<< 
    </textarea> 
     <script> 
     var slideshow = remark.create({ 
      highlightStyle: 'darkula', 
      highlightLines: true 
     }); 
     </script> 
    </body> 
</html> 

理想的には、これはオフラインで、ローカルマシン上で(Webサーバーを実行せずに)実行されます。 'ペースト'マークダウンファイルtest.mdのビットは明らかに動作しません(したがって私の質問)。私が試した:

  • object data="test.md"それは醜いのiframe
  • This solutionを生成しますが、私はちょうど空のページを(私はjQueryのためのCDNを使用)です。あなたは以下

    var slideshow = remark.create({ 
        sourceUrl: 'markdown.md' 
    }); 
    

    あなたの値下げファイルをインクルードする行の下に追加する必要がありremarkjs wikiによると

答えて

0

<!DOCTYPE html> 
<html> 
    <head> 
    <title>A title</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    <style type="text/css"> 
     @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); 
     @import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); 
     @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 

     body { font-family: 'Droid Serif'; } 
     h1, h2, h3 { 
     font-family: 'Yanone Kaffeesatz'; 
     font-weight: normal; 
     } 
     .remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; } 
    </style> 
    </head> 
    <body> 
    <script src="https://remarkjs.com/downloads/remark-latest.min.js" type="text/javascript"> 
    </script> 
    <script type="text/javascript"> 
     var slideshow = remark.create({ 
     sourceUrl: 'your_file.md' 
     }); 
    </script> 
    </body> 
</html> 
完全な例であります
関連する問題