Tracking to HTML from the GitHub README.md file

My goal:

1) Read the source of Markdown from a file README.mdfrom my GitHub repository.
2) Convert Markdown to HTML.
3) Apply HTML output to <div>.

only using technology on the client side.

I know how to convert Markdown code to HTML using jQuery, but I don’t know how to dynamically read the MD source from the README.md file from the GitHub repository.

+5
source share
4 answers
  • Get the source file for the README.md file from the GitHub repository.
  • Format the URL-address in the following format http://markdown.io/<url_readme_file>. Say the URL of my readme.md file http://raw.github.com/pankajparashar/nerdy-css/master/README.md. Consequently, the new url becomeshttp://markdown.io/http://raw.github.com/pankajparashar/nerdy-css/master/README.md
  • jQuery URL- #md-content id .

, - http://jsfiddle.net/pankajparashar/EQBFZ/

+3

:

https://github.com/zmckinnon/jquery-gh-readme

API GitHub readme :

GET/repos/: owner/: repo/readme

base64.

html .

+1
  • GitHub
  • README.md

- URL, .

PHP ( , ), load.php (, RAW). PHP $_GET['url']. file_get_contents() . , .

echo file_get_contents($_GET['url']);

load jQuery, PHP. URL-, , ...

.load("load.php?url=https://raw.github.com/user/project/master/README.md")

, , , Markdown.

0

, HTML ReadMe.md. , , , : ReadMe .. , , / . Readme.md Github.

< br/ " > , , : http://www.w3lc.com/2017/05/new-line-in-readme-file-github-fixing.html

git Github, . , , , , !

, , : 1. URL- ReadMe.md Raw-. , . : https://raw.githubusercontent.com/Anwar-Faiz/forkrap/master/README.md 2. , , file_gets_content .. Php, URL-. , jquery, Load().

Do also note that if you are viewing the Source URL Source page, you simply see plain text. That way, you don’t have to do a lot of text parsing as well :) This is good news.

Then you can use unescape functions or tools like codebeautify to unescape characters that can change with the look of your HTML, for example '<", etc.

0
source

All Articles