13

I would like to create a wiki page that is a preamble (standard markdown) followed by an HTML/JS code listing followed by (in a frame I suppose) the page that this code would generate.

Is this possible?

PS The code is: http://pipad.org/MathBox/slides_simple.html

P i
  • 29,020
  • 36
  • 159
  • 267
  • 2
    Take a look at http://stackoverflow.com/questions/6551446/can-i-run-html-files-directly-from-github-instead-of-just-viewing-their-source "Security reasons prevent us from allowing iframes and etc".. – mesutpiskin Jul 20 '16 at 13:09
  • 1
    Related https://stackoverflow.com/questions/48402823/embed-openstreetmap-iframe-in-github-markdown – Adriano Dec 11 '20 at 13:10

1 Answers1

12

Github Wikis allow you to embed HTML, but not all HTML tags are supported.

To embed supported HTML:

  1. Edit a wiki page.
  2. Ensure the edit mode is on "Markdown".
  3. Type the html directly into the main content area (there's no "code" view, like you often see in tools like Wordpress).

Which tags aren't supported?

I couldn't find documentation on this, but we have a few clues:

  1. Github wikis are built on a software tool called Gollum. We can see which tags are supported in Gollum by default here in the Gollum docs. Github may customize these defaults for their use-case, but I'll bet it's pretty similar.
  2. I went ahead and created a test wiki here with all the major visual html elements added to it (copied from Poor Man's Styleguide). It looks like the main tags that don't display are iframe, video, audio, and all of the various form inputs (textarea, input, select, etc).
bryanbraun
  • 3,025
  • 2
  • 26
  • 38
  • Hmm, seems this only works when manually editing the wiki page, programmatically pushing HTML (in my case from jsdoc) does not work – Patronics Feb 09 '21 at 04:50
  • 2
    Interesting. I'll bet it expects you to use markdown files (which can include embedded html) instead of straight-up html files. – bryanbraun Feb 10 '21 at 05:16
  • 1
    Actually, with a bit more experimentation, I did manage to find a mostly usable implementation, I needed to rename all the files from the default .html to .md, and remove all the leading whitespace, as it interpreted the indentation as a markdown code block, showing all the html source directly. here's my implementation (though it'll likely need modifications for other uses) in case it helps anyone in the future: https://github.com/indigoblueinnovations/github-wiki-publish-action – Patronics Feb 10 '21 at 06:56