* Using orgtbl-mode with markdown: hfmt1
@ 2017-09-12 13:15 Carsten Bormann
2017-09-12 14:07 ` Kaushal Modi
2017-09-14 13:51 ` Nicolas Goaziou
0 siblings, 2 replies; 6+ messages in thread
From: Carsten Bormann @ 2017-09-12 13:15 UTC (permalink / raw)
To: emacs-orgmode
As is, orgtbl-mode is a great addition to markdown-mode.
There is one snag:
The markdown table syntax isn’t fully standardized.
A number of implementations react unfavorable to the + characters that orgtbl-mode uses as a column/row separator in the line separating the header from the body of the table; they prefer the | character here as well.
So I apply this little patch in org-table-align each time I install a new version of org-mode:
org-table.el
874c158
< (hfmt1 "-%s-+"))
---
> (hfmt1 "-%s-|")) ; HACK: + ➔ |
Works perfectly. But it would be nice not to have to apply this patch each time I update.
Would it be possible to make hfmt1 configurable?
(Preferably, using a buffer-local variable so I don’t have to break tables in org-mode proper?)
Grüße, Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using orgtbl-mode with markdown: hfmt1
2017-09-12 13:15 Using orgtbl-mode with markdown: hfmt1 Carsten Bormann
@ 2017-09-12 14:07 ` Kaushal Modi
2017-09-12 14:11 ` Kaushal Modi
2017-09-12 14:16 ` Carsten Bormann
2017-09-14 13:51 ` Nicolas Goaziou
1 sibling, 2 replies; 6+ messages in thread
From: Kaushal Modi @ 2017-09-12 14:07 UTC (permalink / raw)
To: Carsten Bormann, emacs-org list
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
On Tue, Sep 12, 2017, 9:56 AM Carsten Bormann <cabo@tzi.org> wrote:
Works perfectly. But it would be nice not to have to apply this patch each
> time I update.
> Would it be possible to make hfmt1 configurable?
> (Preferably, using a buffer-local variable so I don’t have to break tables
> in org-mode proper?)
>
I use a different approach to do the same thing using ox-gfm (based on a SO
solution). Look for orgtbl-to-gfm function here[1] and also my notes at
the end of that file.
[1]:
https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-markdown.el
> --
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 1454 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using orgtbl-mode with markdown: hfmt1
2017-09-12 14:07 ` Kaushal Modi
@ 2017-09-12 14:11 ` Kaushal Modi
2017-09-12 14:16 ` Carsten Bormann
1 sibling, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2017-09-12 14:11 UTC (permalink / raw)
To: Carsten Bormann, emacs-org list
[-- Attachment #1: Type: text/plain, Size: 230 bytes --]
On Tue, Sep 12, 2017, 10:07 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> I use a different approach to do the same thing using ox-gfm
>
Correcting myself.. that solution has nothing to do with ox-gfm.
> --
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 865 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using orgtbl-mode with markdown: hfmt1
2017-09-12 14:07 ` Kaushal Modi
2017-09-12 14:11 ` Kaushal Modi
@ 2017-09-12 14:16 ` Carsten Bormann
1 sibling, 0 replies; 6+ messages in thread
From: Carsten Bormann @ 2017-09-12 14:16 UTC (permalink / raw)
To: Kaushal Modi; +Cc: emacs-org list
On Sep 12, 2017, at 16:07, Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> On Tue, Sep 12, 2017, 9:56 AM Carsten Bormann <cabo@tzi.org> wrote:
>
>
> Works perfectly. But it would be nice not to have to apply this patch each time I update.
>
> Would it be possible to make hfmt1 configurable?
> (Preferably, using a buffer-local variable so I don’t have to break tables in org-mode proper?)
>
> I use a different approach to do the same thing using ox-gfm (based on a SO solution). Look for orgtbl-to-gfm function here[1] and also my notes at the end of that file.
>
> [1]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-markdown.el
> --
> Kaushal Modi
>
I am aware of a number of these workarounds.
The specific one you are proposing does not work for me as the markdown tables are in collaboratively edited documents and I can’t get the other authors to do any special dance around the tables; orgtbl-mode has to just work.
Besides, a 83-line workaround for what can be done seamlessly by changing one line of code?
(Yes, it would be nice to also preserve the column alignments, but we already have a solution that gets around that limitation.)
Grüße, Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using orgtbl-mode with markdown: hfmt1
2017-09-12 13:15 Using orgtbl-mode with markdown: hfmt1 Carsten Bormann
2017-09-12 14:07 ` Kaushal Modi
@ 2017-09-14 13:51 ` Nicolas Goaziou
2017-09-14 14:13 ` Carsten Bormann
1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-09-14 13:51 UTC (permalink / raw)
To: Carsten Bormann; +Cc: emacs-orgmode
Hello,
Carsten Bormann <cabo@tzi.org> writes:
> As is, orgtbl-mode is a great addition to markdown-mode.
>
> There is one snag:
>
> The markdown table syntax isn’t fully standardized.
> A number of implementations react unfavorable to the + characters that
> orgtbl-mode uses as a column/row separator in the line separating the
> header from the body of the table; they prefer the | character here as
> well.
>
> So I apply this little patch in org-table-align each time I install a new version of org-mode:
>
> org-table.el
> 874c158
> < (hfmt1 "-%s-+"))
> ---
>> (hfmt1 "-%s-|")) ; HACK: + ➔ |
>
> Works perfectly. But it would be nice not to have to apply this patch each time I update.
>
> Would it be possible to make hfmt1 configurable?
> (Preferably, using a buffer-local variable so I don’t have to break
> tables in org-mode proper?)
The point of orgtbl-mode is to edit Org tables, not Markdown tables,
which have a different syntax.
The usual workflow is to edit the Org mode tables and "send" it to
another location within the same buffer, applying some pre-defined
transformation. See (info "(org) Radio tables") for more information.
Another option is to add an advice on `org-table-align'. See
`add-advice'.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using orgtbl-mode with markdown: hfmt1
2017-09-14 13:51 ` Nicolas Goaziou
@ 2017-09-14 14:13 ` Carsten Bormann
0 siblings, 0 replies; 6+ messages in thread
From: Carsten Bormann @ 2017-09-14 14:13 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
> The point of orgtbl-mode is to edit Org tables, not Markdown tables,
> which have a different syntax.
The point of a screwdriver is to drive screws.
I happened to notice that this particular screwdriver makes a good chisel, too.
Unfortunately, the way things are at the moment means that using this screwdriver as a chisel damages it (by making me change the native org-mode table syntax, too).
The analogy stops here: Different from an actual screwdriver, it is possible to add a switch to org-table-align that allows to use it for either purpose, without damage.
(To me, it seems that the existence of an orgtbl-mode minor mode points out that this kind of use outside org-mode is not an entirely foreign concept here.)
> The usual workflow is to edit the Org mode tables and "send" it to
> another location within the same buffer, applying some pre-defined
> transformation. See (info "(org) Radio tables") for more information.
These workflows would make more sense if I’m working alone on the document.
Well, then I could write them entirely in org-mode in the first place.
The point of writing them in markdown is to be able to collaborate with people who don’t use org-mode (or Emacs, or even a plaintext editor at all!).
> Another option is to add an advice on `org-table-align'. See
> `add-advice’.
That doesn’t work too well as the tiny change is in the middle of that function; advice-add could be used to manipulate its input or its output, but not that small difference in table syntax between org-mode and github markdown (the main culprit here — many other markdown implementations don’t have a problem with org-mode table syntax).
Grüße, Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-14 14:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-12 13:15 Using orgtbl-mode with markdown: hfmt1 Carsten Bormann
2017-09-12 14:07 ` Kaushal Modi
2017-09-12 14:11 ` Kaushal Modi
2017-09-12 14:16 ` Carsten Bormann
2017-09-14 13:51 ` Nicolas Goaziou
2017-09-14 14:13 ` Carsten Bormann
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).