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 8125859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:57:28+00:00 2026-06-06T06:57:28+00:00

I need to create a live preview container (like stackoverflow and Reddit) for my

  • 0

I need to create a live preview container (like stackoverflow and Reddit) for my django website using textile as my markup language.

live preview - Reddit

Is there a way to do it on the client side? (without using ajax?)

Parsing the code from the view is as simple as:

{% load markup %}
{{ theme.content|textile }}

(Needless to say, I followed the documentation and included 'django.contrib.markup' to my INSTALLED_APPS setting.)

For simplicity’s sake, lets assume I don’t need IE support. My JS looks as follows:

function change_preview() {
    var fragment = document.createDocumentFragment();
    // I am no sure what should I put here:
    fragment.appendChild(document.createTextNode('{{ theme.content|textile }}'))
    document.getElementById("preview").appendChild(fragment);
}

window.onload = function() {
    var content_box = document.getElementById('id_content');
    content_box.addEventListener("input", change_preview , false );
}

And HTML:

<textarea id="id_content" rows="10" cols="40" name="content"></textarea>
<div id = "preview"></div>

Also I found this JS library. Is it a good idea to use it on the client-side together with PyTextile on the server-side?

What are the best practices?

I am looking for non-jQuery solutions, but I will accept one if there are no other ways to do it.

Thank you in advance.

  • 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-06-06T06:57:30+00:00Added an answer on June 6, 2026 at 6:57 am

    Since textile specifies what markup corresponds to what html I don’t see a big potential for incompatibilities between a JS lib and a Py lib.

    In your script for an immediate preview update you might want to use the keyup event instead of the input event since the latter is only fired when the textarea looses focus.

    window.onload = function() {
        var content_box = document.getElementById('id_content');
        content_box.addEventListener("keyup", change_preview , false );
    }
    

    To use Ben Daglish’s lib, which is not based on jQuery, your event handler would look like this:

    function change_preview() {
        var content_box = document.getElementById('id_content');
        var html = convert(content_box.value);
        document.getElementById('preview').innerHTML=html;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a live orders page for my website. I need
I need your help. I need to create live wallpaper like this : Bikini
I want to create a live, checkers-like app, which will work like this: There
Need to create a custom DNS name server using C which will check against
i found XMPP on google (i need create a application IM look like Yahoo
I need to create routing in Zend to simply copy the current live site
I need to create a tool that will check a domains live mx records
I am trying to create website to show a live twitter feed concerning a
I need to create a mobile website for a Joomla website that is already
I need to build a live preview in Flash which will show a user

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.