Skip to content

vkostyukov/jquery-ascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery ASCII

jQuery ASCII is an extrimally simple & lightweight (~1,5kb) jQuery plugin for HTML-TO-ASCII table converting.

Usage example

Source table

<table id="html-table">
	<tr><th>Header 1</th><th>Header 2</th></tr>
	<tr><td>Cell 1</td><td>Cell 2</td></tr>
	<tr><td>Cell 3</td><td>Cell 4</td></tr>
</table>

Target block

<div id="ascii-table"></div>

jQuery code

$(document).ready(function() {
	$("#ascii-table").html($("#html-table").ascii());
});

Result table in #ascii-table block

+---------------------+
| Header 1 | Header 2 |
+---------------------+
| Cell 1   | Cell 2   |
| Cell 3   | Cell 4   |
+---------------------+

Raw Table Format

There is also raw format available for generated table. This format uses native symbols for spaces and newlines. The raw format can be specified by following:

$("#html-table").ascii("raw")

Other

See demo.html for more details.

About

simple jQuery plugin for converting tables to ASCII representaion

Resources

Stars

Watchers

Forks

Packages

No packages published