Git Product home page Git Product logo

jquery-ascii's Introduction

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.

jquery-ascii's People

Contributors

vkostyukov avatar

Stargazers

Anatolii Smolianinov avatar George Norris avatar Julia Kostiukova avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

ronibvb phplaw

jquery-ascii's Issues

Align numbers right

It would be nice to check to see if columns have numbers and align them to the right.

Change .html() to .text()

I had a table with some SPAN tags inside and the plugin didn't work any more because I gets the cell content with .html(). So I propose to change .html() to .text(), then it will work great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.