{"id":47865979,"url":"https://github.com/dnouri/markdown-table-wrap","last_synced_at":"2026-04-04T00:14:00.085Z","repository":{"id":341795442,"uuid":"1171152696","full_name":"dnouri/markdown-table-wrap","owner":"dnouri","description":"Emacs package to word-wrap GFM pipe tables to fit a given character width","archived":false,"fork":false,"pushed_at":"2026-03-16T09:40:26.000Z","size":80,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-16T09:43:42.815Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnouri.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-02T23:34:07.000Z","updated_at":"2026-03-16T03:53:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dnouri/markdown-table-wrap","commit_stats":null,"previous_names":["dnouri/markdown-table-wrap"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dnouri/markdown-table-wrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fmarkdown-table-wrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fmarkdown-table-wrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fmarkdown-table-wrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fmarkdown-table-wrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnouri","download_url":"https://codeload.github.com/dnouri/markdown-table-wrap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fmarkdown-table-wrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31382390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T23:20:52.058Z","status":"ssl_error","status_checked_at":"2026-04-03T23:20:51.675Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T00:13:57.941Z","updated_at":"2026-04-04T00:14:00.075Z","avatar_url":"https://github.com/dnouri.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+title: markdown-table-wrap\n#+author: Daniel Nouri\n\n#+html: \u003ca href=\"https://melpa.org/#/markdown-table-wrap\"\u003e\u003cimg alt=\"MELPA\" src=\"https://melpa.org/packages/markdown-table-wrap-badge.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/dnouri/markdown-table-wrap/actions/workflows/test.yml\"\u003e\u003cimg alt=\"Tests\" src=\"https://github.com/dnouri/markdown-table-wrap/actions/workflows/test.yml/badge.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/dnouri/markdown-table-wrap/actions/workflows/melpazoid.yml\"\u003e\u003cimg alt=\"melpazoid\" src=\"https://github.com/dnouri/markdown-table-wrap/actions/workflows/melpazoid.yml/badge.svg\"/\u003e\u003c/a\u003e\n\nWord-wrap GFM (GitHub Flavored Markdown) pipe tables to fit a\ngiven character width.  Inline markup survives wrapping.\n\n#+begin_example\n| Feature   | Status | Notes                         |\n|-----------|--------|-------------------------------|\n| **Auth**  | Done   | OAuth2 with `refresh tokens`  |\n| **DB**    | WIP    | PostgreSQL *connection pool*  |\n#+end_example\n\n=(markdown-table-wrap table-string 36)= rewrites this as:\n\n#+begin_example\n| Feature  | Status | Notes        |\n| -------- | ------ | ------------ |\n| **Auth** | Done   | OAuth2 with  |\n|          |        | `refresh`    |\n|          |        | `tokens`     |\n|          |        |              |\n| **DB**   | WIP    | PostgreSQL   |\n|          |        | *connection* |\n|          |        | *pool*       |\n#+end_example\n\nThe wrapped text is meant for readable source editing and\nround-tripping with =markdown-table-wrap-unwrap=.  It is not a\nsemantic no-op for Markdown renderers: wrapped headers are no\nlonger valid GFM tables, and wrapped body continuation lines and\nautomatic spacer rows are parsed as additional rows.  Bold,\nitalic, code, links, images, and strikethrough markers are\nduplicated on each continuation line.  In buffers where\n=markdown-hide-markup= conceals syntax characters, column widths\ncan be measured from visible text so that hidden markers do not\nwaste space.\n\n* Installation\n\nInstall from [[https://melpa.org/#/markdown-table-wrap][MELPA]]:\n\n#+begin_src\nM-x package-install RET markdown-table-wrap RET\n#+end_src\n\nIf MELPA is not configured yet, add this to your init file, restart\nEmacs, and run =M-x package-refresh-contents= once:\n\n#+begin_src elisp\n(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)\n#+end_src\n\nIf you use the library from your own code, load it with:\n\n#+begin_src elisp\n(require 'markdown-table-wrap)\n#+end_src\n\nIf you prefer =use-package=:\n\n#+begin_src elisp\n(use-package markdown-table-wrap\n  :ensure t)\n#+end_src\n\n** Manual installation\n\nIf you prefer a plain checkout, add the repository to your =load-path=\nand require the library:\n\n#+begin_src elisp\n(add-to-list 'load-path \"/path/to/markdown-table-wrap\")\n(require 'markdown-table-wrap)\n#+end_src\n\n* Usage\n\n#+begin_src elisp\n(markdown-table-wrap table-text 60)\n#+end_src\n\nOptional arguments:\n\n#+begin_src elisp\n;; Cap cell height at 3 lines (truncated cells end with \"…\")\n(markdown-table-wrap table-text 60 3)\n\n;; Measure widths from visible text only (for markdown-hide-markup)\n(markdown-table-wrap table-text 60 nil t)\n\n;; Suppress automatic empty rows between wrapped data rows\n(markdown-table-wrap table-text 60 nil nil t)\n#+end_src\n\n** Unwrapping and re-wrapping\n\nWrapped output is optimized for readable source, not for preserving\nexact GFM table semantics in Markdown-to-HTML renderers.\n\n#+begin_src elisp\n(markdown-table-wrap\n (markdown-table-wrap-unwrap previously-wrapped) new-width)\n#+end_src\n\n** Batch rendering\n\nParse and measure once, render at each width:\n\n#+begin_src elisp\n(markdown-table-wrap-batch table-text '(40 60 80 120))\n#+end_src\n\n** Integration example\n\n#+begin_src elisp\n(defun my-wrap-table-at-point ()\n  \"Wrap the pipe table at point to fit the window.\"\n  (interactive)\n  (save-excursion\n    (let* ((beg (progn (re-search-backward \"^|\" nil t)\n                       (line-beginning-position)))\n           (end (progn (re-search-forward \"^[^|]\" nil t)\n                       (line-beginning-position)))\n           (text (buffer-substring-no-properties beg (1- end)))\n           (wrapped (markdown-table-wrap\n                     text (window-width)\n                     nil                     ; max cell height\n                     markdown-hide-markup))) ; t when markup hidden\n      (unless (equal wrapped text)\n        (delete-region beg (1- end))\n        (goto-char beg)\n        (insert wrapped)))))\n#+end_src\n\n* Features\n\n- Markup-aware: bold, italic, links, code, images, strikethrough\n- Graceful degradation when columns are too narrow for markup\n- Proportional column-width allocation\n- Alignment preservation (=:---:=, =---:=, =:---=)\n- Cell height cap with ellipsis\n- Unwrap/re-wrap for resizing; batch rendering\n- Code fence awareness\n- Unicode-aware (CJK, combining marks, VS16 emoji)\n- Pure Elisp, no dependencies\n\n* API\n\n** Primary functions\n\n- ~(markdown-table-wrap TEXT WIDTH \u0026optional MAX-CELL-HEIGHT STRIP-MARKUP COMPACT)~\n\n  Rewrite a pipe table to fit WIDTH.  Returns pipe-table-shaped text\n  for readable source editing and round-tripping with\n  =markdown-table-wrap-unwrap=, or TEXT unchanged when it already\n  fits.  Wrapped headers are no longer valid GFM tables, and wrapped\n  body continuation lines and automatic spacer rows are parsed as\n  additional rows by Markdown renderers.  STRIP-MARKUP measures\n  widths from visible text (for =markdown-hide-markup=).  COMPACT\n  suppresses automatic empty rows between wrapped data rows.\n\n- ~(markdown-table-wrap-batch TEXT WIDTHS \u0026optional MAX-CELL-HEIGHT STRIP-MARKUP COMPACT)~\n\n  Render at each width in WIDTHS.  Parses once.\n\n- ~(markdown-table-wrap-unwrap TEXT)~\n\n  Merge continuation rows back into logical rows when their\n  boundaries remain detectable.  Best suited for text known to be\n  produced by =markdown-table-wrap=.\n\nThe package also exposes =markdown-table-wrap-parse=,\n=markdown-table-wrap-cell=, =markdown-table-wrap-compute-widths=,\n=markdown-table-wrap-strip-markup=, =markdown-table-wrap-visible-width=,\nand =markdown-table-wrap-inside-code-fence-p=.  See their docstrings\nfor details.\n\nAll public functions are pure (except =inside-code-fence-p=).  No\n=defcustom= is defined; configuration is passed as arguments.\n\n* License\n\nGPL-3.0-or-later\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnouri%2Fmarkdown-table-wrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnouri%2Fmarkdown-table-wrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnouri%2Fmarkdown-table-wrap/lists"}