Can I render and display Markdown from Github into MEAN stack website dynamically? - github

I'm developing a website using the MEAN stack framework and wanted to know if there is any way I can dynamically render a Markdown page that lives on a Github repository.
I don't want to redeploy the site every time a change is made to the Markdown file.

Use GitHub Pages: push to the gh-pages branch and GitHub will do the markdown to HTML conversion and serve you the HTML (not rate-limited) at http://yourusername.github.io/yourrepo. Just make an HTTP call to that address to fetch your content.
If you want to do the Markdown to HTML conversion yourself, fetch the Markdown via RawGit.

Related

Github Jekyll theme hacker style does not apply to sublinks

I created a GitHub page with a hacker theme.
Then, I created another .md file (other than the index.md) and linked it to the index file.
The referenced .md (named as testlink.md) does not have the same style, unfortunately.
Here is the code: https://github.com/YesimSem/thecuriousanimal/tree/gh-pages
How may I ensure that all the .md files have that same style?
Thank you,
Updated Answer
Your link needs to be changed from .md to .html. Please see this pull request on your repository for the fix. The testlink.md is being rendered correctly but your link is going to the original Markdown file. It should be going to the HTML rendering of the Markdown file. See this URL for the correct page https://yesimsem.github.io/thecuriousanimal/testlink.html
Original Answer
You need to add Jekyll Front Matter to your new page (i.e. testlink.md) and specify the a Jekyll layout. In your situation, your new page needs the same layout as the index.md from the GitHub Jekyll Hacker theme. See the layout specified at the top of index.md.

Generate github pages with navigation elements

I have a project on github that includes a number of markdown files (introduction, user guide, examples, reference).
I want to create a website using Github Pages based on these files that also includes a navigation element of some sorts, like a simple sidebar containing links to all the generated pages.
It seems that, out-of-the-box, pages generated with Github Pages are all stand-alone with no way to navigate between them.
Is there an easy way to achieve this, or is this use case too complicated for github pages? The documentation seems to be lacking on this point.
The Markdown to link to pages within the same folder
[__PageA__](PageA.md)
[__PageB__](PageB.md)
To link to pages in other folders just put in the relative link like this
[__PageC__](FolderC/PageC.md)
[__PageX__](../../PageX.md)
This works for files hosted on GitHub ... how you then use these to generate a standalone website you would need a tool that converts Markdown to HTML, something I have not looked into.

Is there a way to create a simple Markdown wiki with GitHub pages?

I want to use GitHub pages to write and host my own system administration wiki in Markdown.
I already created a repository with myname.github.io and placed in it only one file index.html with the text:
Hello world!
As the result I want a structured Markdown wiki, for example:
index.html
io/mdadm.md
io/lvm.md
io/disks.md
mail/postfix.md
mail/mail.md
bacula/setup.md
bacula/tips.md
bash/tips.md
system/applications/repositories.md
When I will navigate to http://myname.github.io I want to see the main page with links to another. I will create the main page in HTML manually.
When I will navigate to http://myname.github.io/system/applications/repositories or something else I want to see rendered Markdown HTML.
How can I create this layout and force GitHub to render Markdown files into HTML?
Is there a better way to use GitHub as a free wiki?
I also understand that I can use standard md files in a repository and default GitHub repository interface. But this interface is over complicated, compared to pure HTML rendered from Markdown.
You can use Jekyll, the static site generator which works very well with GitHub pages and uses Markdown out of the box.
See documentation here.

Display .jsonld Files in gh-pages

I'm trying to display JSON-LD data using the .jsonld extension in our gh-pages in the browser instead. I'd like to use the actual files as a reference. We can serve them as downloadable files but would prefer to display the raw data. We're using a Jekyll theme. Is there a config setting for this? Thanks
AFAICT that's not possible. You could use Gists instead or directly link to the file on GitHub

GitHub Pages: How do I edit this page in markdown format, just as I created it?

I'm not too comfortable with touching the generated HTML that the site gives, I was wondering whether there is any way to change the contents of my page in markdown formatting, the same way that I did upon creating the page?
Any input as to go about doing this would be awesome.
By default, GitHub Pages helps you generate html pages only.
But if you setup your site to use jekyll, then you can store files in markdown. For example, in the _posts section of this repo 'cboettig/labnotebook' which is generated to carlboettiger.info.
See Help page "Using Jekyll with Pages"
More specifically (as highlighted in esfandia's answer), see "The Automatic Page Generator", which allows for markdown editing.
As commented by dregad, there is a new theme chooser in Dec. 2016:
See this article by Antriksh Yadav:
Update August 2016: Simpler GitHub Pages publishing now allows to keep your page files in a subfolder of the same branch (no more gh-pages needed):
So you don't need multiple branch anymore.
If you replace index.html with index.md containing your original markdown text, and add a "Front Matter" section at the top, then you can do your page editing in markdown.
It's totally possible and supported: just go back to "Settings", scroll down to GitHub Pages. The Source you used to create your initial page should still be there, and when you click on "Launch automatic page generator" it will allow you to update the markdown code right there in the browser.
When you're done you'll need to select the layout again, but once you're done with that it will create a new index.html, commit it using the GitHub pages source you chose, and publish the modified page.
You need Jekyll. The documentation you are looking for is here: https://help.github.com/articles/using-jekyll-with-pages