GithubHelp home page GithubHelp logo

org-pretty-table's Introduction

org-pretty-table

Draw pretty unicode tables in org-mode and orgtbl-mode.

Very experimental.

example

Usage

Enable the org-pretty-table-mode in an org buffer and it will replace the ASCII table borders with beautiful unicode ones. The replacement is only visual (using display text properties), nothing in your file is actually changed. The buffer and the file saved to disc still contains the original ASCII characters (which it must since that's what org uses for table detection).

You can customize org-pretty-table-charset to change the border characters. This mode comes with two built-in "themes", single horizontal lines and double horizontal lines. See M-x customize-variable RET org-pretty-table-charset RET.

Installation

This package is not yet distributed through package archives and you have to install it manually.

  1. Download the org-pretty-table.el file into some folder in your hard drive (for example ~/.emacs.d/site-lisp).

  2. Put the following code into your ~/.emacs.d/init.el or ~/.emacs file:

(progn
  (add-to-list 'load-path "~/.emacs.d/site-lisp")
  (require 'org-pretty-table)
  (add-hook 'org-mode-hook (lambda () (org-pretty-table-mode))))
  1. Evaluate the progn block by putting the point on the progn and calling C-M-x (M-x eval-defun). If unsure, you can also simply restart Emacs.

  2. Open an org-mode file. Calling M-: org-pretty-table-mode RET should print 1 in the minibuffer. You're done!

Development

Use Eask to install dependencies:

eask install-deps --dev

Run tests with

eask test buttercup

org-pretty-table's People

Contributors

codecoll avatar fuco1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

org-pretty-table's Issues

Characters at the bottom of the table are not properly replaced when there is a link in column

Thank you for this awesome package!
I noticed that some characters at the bottom of the table are not properly replaced when there is a link in column.
They're replaced correctly if I remove the link.
image

Here is plain text:

|---------+------+---------+---------+---------|
| column1 | [[https://github.com/][link]] | column2 | column3 | column4 |
|---------+------+---------+---------+---------|

|---------+------+---------+---------+---------|
| column1 | link | column2 | column3 | column4 |
|---------+------+---------+---------+---------|

[Tutorial] How to install this package

Hi,

This is an excellent package, however there are no instructions for how to install it.
If you are new to emacs and don't understand how to install this, here are some directions:

  1. Download the org-pretty-table.el file into some folder in your hard drive (I created a folder called emacs_plugins on my Desktop and put it in there)
  2. Put the following code into your .emacs file:
(add-to-list 'load-path "/Users/cor/Desktop/emacs_plugins/")
(require 'org-pretty-table)
(add-hook 'org-mode-hook (lambda () (org-pretty-table-mode)))
  1. Now restart emacs and you should be done!

Of course, you can substitute /Users/cor/Desktop/emacs_plugins/ with whatever directory you put the org-pretty-table.el file into.

Push upstream?

Hey!

This minor mode works fine for me. Do you intend to push it upstream? Or have it somehow integrated as an option directly in Org?

minor optical bug

If a heading is not followed or preceded with an empty line the table connects to it like this:

|---+---|
*** some heading
|---+---|

This looks kind a ugly. I think a better behavior would be for the table not to connect to a line starting with "*" like so:

⎣___|____⎦
*** another heading
⎡‾‾|‾‾⎤

[Bug] Tables misaligns when using emoji

Perhaps more of a problem with org-tables in general, but emoji characters cause the table alignment of column borders to drift off by one for every character used.

Is there a way to fix this? I tend to use emoji quite a lot in my tables so this does mess up the alignment, sadly.

At least with Apple Color Emoji fontset. Sample below of effect if you paste into an emacs table under org-pretty-table (I know emoji are kinda 2 character spaces but imagine the plugin could perhaps detect for this?

|----+----------+----------+----------+---------+----------+-----------+-----------|
|    | Mon      | Tue      | Wed      | Thu     | Fri      | Sat       | Sun       |
|----+----------+----------+----------+---------+----------+-----------+-----------|
| Me | 💪🏼 Write | ✅ Blog  | 💪🏼 Write | ✅ Blog | ❌ Write | ✅ Astro  | ✅ Pony   |
|    | ✅ Astro | ✅ Code     | 💪🏼 Astro | ❌ Code | ❌ Astro | ✅ Coding | ✅ Code   |
|    | ❌ Game  | ✅ WO    |          | ✅ WO   |          |           | ✅ Flight |
|    |          | ❌ Movie |          |         |          |           |           |
|----+----------+----------+----------+---------+----------+-----------+-----------|
| DH |          |          |          |         |          |           |           |
|    |          |          |          |         |          |           |           |
|    |          |          |          |         |          |           |           |
|----+----------+----------+----------+---------+----------+-----------+-----------|

indentation

Indented tables not rendered properly. Consider this example:


This works:

|---+---|
| A | B |
|---+---|
| 1 | 2 |
| 3 | 4 |
|---+---|

This Does not:

 |---+---|
 | A | B |
 |---+---|
 | 1 | 2 |
 | 3 | 4 |
 |---+---|

(note that 2nd table is indented by 1 space).
The rendering:

image

Buggy rendering when table is at very top of buffer

I have a buffer (in orgtbl-mode) containing this:

| panel_id | gs_use | species_id |
|----------+--------+------------|
|        1 | false  |          1 |
|        2 | false  |          1 |
|        3 | false  |          1 |
|        4 | false  |          1 |

which renders like this, with a buggy header divider line:
image

If I insert a blank line at the top, like so:


| panel_id | gs_use | species_id |
|----------+--------+------------|
|        1 | false  |          1 |
|        2 | false  |          1 |
|        3 | false  |          1 |
|        4 | false  |          1 |

I get the expected rendering (although with the extra blank line at the top):
image

A few comments

This may be abandoned, but I've just found it, and I like it ... a lot.

Two deficiencies I have come across:

  • It changes hyphens - for the entire buffer, not just tables
  • + symbols remain unchanged, perhaps could be handy?

I see you weren't that interested in upstreaming it five years ago, but it would now fit in very nicely with org pretty entities.

Is there any chance you may work on this some more in the future?

Org table format breaks when using a "-" in the link to a file.

For example this layout breaks..

| col A                                  | col B                                  |
| plain text                             | plain text                             |
| bold text                              | *bold text*                              |
| underline text                         | _underline text_                         |
| bold and underline text                | *_bold and underline text_*              |
| https://wwww.ace.org                   | https://www.acme.org                   |
| [[https://www.acme.org][text with https link]]                   | [[https://www.acme.org][text with https link]]                   |
| [[file:file.txt][text with file link]]                    | [[file:file.txt][text with file link]]                    |
| [[file:text file.txt][text with a file link including a " "]]  | [[file:text file.txt][text with a file link including a " "]]  |
| [[file:text_file.txt][text with a file link including a "_"]]  | [[file:text_file.txt][text with a file link including a "_"]]  |
| [[file:text-file.txt][text with a file link including a "-"]] | [[file:text-file.txt][text with a file link including a "-"]] |

image

I noticed this when using org-roam that uses id's inside the link and a table broke.

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.