Skip to content

Instantly share code, notes, and snippets.

@oguna
Last active June 26, 2023 16:27
Show Gist options
  • Select an option

  • Save oguna/9683208 to your computer and use it in GitHub Desktop.

Select an option

Save oguna/9683208 to your computer and use it in GitHub Desktop.
Github APIを用いてMarkdownをHTMLに変換するPythonスクリプト
#!/usr/bin/env python
# this script on only PYTHON3
import urllib.request
import urllib.parse
with open('index.md','br') as file:
data = file.read()
request = urllib.request.Request('https://api.github.com/markdown/raw')
request.add_header('Content-Type','text/plain')
f = urllib.request.urlopen(request,data)
with open('index.html','bw') as file:
file.write(f.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment