Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5951049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:28:53+00:00 2026-05-22T17:28:53+00:00

I really love the function on the github’s code box, especially the ’embed’ and

  • 0

I really love the function on the github’s code box, especially the ’embed’ and ‘raw’ function.I am curious about how to implement a code box like that.(Not the code highlight,just the ’embed’ and ‘raw’ function)

example

Have you every seen any plugins or some other thing can make that?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:28:53+00:00Added an answer on May 22, 2026 at 5:28 pm

    Here is how they do it: they have the raw file on their server, so when you click raw, it just executes the following script

    window.open('whateverrawcode.rb');
    

    For the ’embed’ functionality, what they do is they have the code again, and on the server, they convert the code to html with classes added for syntax highlighting. In the script that they give you, the just document.write out the link to the stylesheet and then document.write out the HTML. I have taken a look at the script for the ruby code, here it is:

    document.write('<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>')
    
    document.write('<div id=\"gist-984320\" class=\"gist\">\n  \n  \n    \n      \n        \n\n        <div class=\"gist-file\">\n          <div class=\"gist-data gist-syntax\">\n            \n            \n            \n              <div class=\"gist-highlight\"><pre><div class=\'line\' id=\'LC1\'><span class=\"nb\">require<\/span> <span class=\"no\">File<\/span><span class=\"o\">.<\/span><span class=\"n\">expand_path<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;../config/application&#39;<\/span><span class=\"p\">,<\/span> <span class=\"bp\">__FILE__<\/span><span class=\"p\">)<\/span><\/div><div class=\'line\' id=\'LC2\'><span class=\"nb\">require<\/span> <span class=\"s1\">&#39;rake&#39;<\/span><\/div><div     class=\'line\' id=\'LC3\'>  and more HTML')
    

    I deleted a lot of the HTML to shorten the code, but that’s the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is one thing I really love about LXML, and that the E builder.
I really love the philosophy of chaining methods, like jQuery emphasys in its library.
I really love the way Ajax makes a web app perform more like a
I love webpy, it's really quite Pythonic but I don't like having to add
I'd like some help with the following jQuery code if possible... $(document).ready(function() { $('table.sortable').each(function()
I have been using ruby exclusively for about a month and I really love
I'm new to Python and I really love the min function. >>>min([1,3,15]) 0 But
i really love the jquery validation plugins, look neat stylish and accessible, but as
I really love working with Django and Python, when I go back to PHP
I really love org-mode in emacs and want to customize a few things. While

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.