1👍
✅
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;
}
Source:stackexchange.com