5

When I write a table like

| Syntax      | Description | More columns ... |
| ----------- | ----------- | ---------------- |
| Header      | Title       | .                |
| Paragraph   | Text        | .                |

in Markdown mode I start writing the first line

| Syntax      | Description | More columns ... |

and then, for the second line

| ----------- | ----------- | ---------------- |

I was hoping Markdown Mode could generate it for me, but I haven't found a function/command for it.

Can Markdown Mode (or another Markdown package) do this?

1 Answer 1

5

Try hitting TAB

I started with:

| id | name | phone | email |

Then I typed "|-" on the next line.

| id | name | phone | email |
|-

Then I hit TAB (or M-x markdown-cycle):

| id | name | phone | email |
|----|------|-------|-------|
|    |      |       |       |

Emacs generated the horizontal lines and an empty row to fill in. I found it by playing around. Hitting TAB works in org-mode with its tables too.

3
  • 1
    Interesting! Doesn't seem to work for me. Which command gets for you executed when you hit TAB (in a Markdown buffer).
    – halloleo
    Commented Sep 16, 2023 at 12:38
  • @halloleo - The function that is bound to TAB is markdown-cycle in this context. I was able to M-x markdown-cycle when my cursor was after the "|-" to get the same result just now.
    – g-gundam
    Commented Sep 16, 2023 at 15:23
  • 1
    Thanks! That works for me! (Have added it to the answer.)
    – halloleo
    Commented Sep 17, 2023 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.