<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8"/>
  <title>markdown in the browser</title>
  
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/styles/railscasts.min.css">
  <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/styles/atom-one-dark.min.css"> -->
  <script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/highlight.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/10.0.0/markdown-it.min.js"></script>
  <style>
  .md_source{
    display: none
  }
  </style>
</head>
  <body>
    <h1>Welcome to Yang's Blog!</h1>
	
<pre class="md_source">
# markdown-it in the browser
Rendered by **markdown-it**.
# 欢迎使用Markdown
Name    | Age
--------|------
Bob     | 27
Alice   | 23

```golang
package main
import "fmt"

func main() {
	fmt.Println("hello ")
}
```
</pre>
<div class="md_render">
</div>
  <script>
	var md;
	var defaults = {
	  html: false, // Enable HTML tags in source
	  xhtmlOut: false, // Use '/' to close single tags (<br />)
	  breaks: false, // Convert '\n' in paragraphs into <br>
	  langPrefix: 'language-', // CSS language prefix for fenced blocks
	  linkify: true, // autoconvert URL-like texts to links
	  typographer: true, // Enable smartypants and other sweet transforms
	  // options below are for demo only
	  _highlight: true,
	  _strict: false,
	  _view: 'html' // html / src / debug
	};
	defaults.highlight = function (str, lang) {
	  var esc = md.utils.escapeHtml;
	 
	  if (lang && hljs.getLanguage(lang)) {
		try {
		  return '<pre class="hljs"><code>' +
				 hljs.highlight(lang, str, true).value +
				 '</code></pre>';
		} catch (__) {}
	  }
	  return '<pre class="hljs"><code>' + esc(str) + '</code></pre>';
	};
	md = window.markdownit(defaults);
    $('.md_render').html(md.render($('.md_source').html()));
  </script>
  </body>
</html>