{"id":44533181,"url":"https://github.com/pandoc-ext/run-lua","last_synced_at":"2026-02-13T18:41:30.285Z","repository":{"id":64613279,"uuid":"576610071","full_name":"pandoc-ext/run-lua","owner":"pandoc-ext","description":"Run Lua code that is embedded into documents via XML processing instructions","archived":false,"fork":false,"pushed_at":"2023-04-28T06:33:21.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-04-28T07:37:11.610Z","etag":null,"topics":["lua","pandoc","pandoc-filter","quarto","quarto-extension","quarto-filter"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pandoc-ext.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-10T11:57:27.000Z","updated_at":"2023-04-28T06:35:16.000Z","dependencies_parsed_at":"2022-12-19T13:22:29.283Z","dependency_job_id":null,"html_url":"https://github.com/pandoc-ext/run-lua","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/pandoc-ext/run-lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandoc-ext%2Frun-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandoc-ext%2Frun-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandoc-ext%2Frun-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandoc-ext%2Frun-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pandoc-ext","download_url":"https://codeload.github.com/pandoc-ext/run-lua/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandoc-ext%2Frun-lua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29414282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["lua","pandoc","pandoc-filter","quarto","quarto-extension","quarto-filter"],"created_at":"2026-02-13T18:41:29.631Z","updated_at":"2026-02-13T18:41:30.281Z","avatar_url":"https://github.com/pandoc-ext.png","language":"Lua","readme":"run-lua\n=======\n\nExecutes any Lua command in a `lua` XML processing instruction and\nincludes the result in the document.\n\nExample:\n\n``` markdown\nThe number \u003c?lua return 1 + 2 + 3 + 4 + 5?\u003e is the fifth triangular number.\n```\n\nThis yields\n\n\u003e \u003cdiv id=\"output\"\u003e\n\u003e\n\u003e The number 15 is the fifth triangular number.\n\u003e\n\u003e \u003c/div\u003e\n\nThe value that’s returned by the Lua code is spliced back into the\ndocument. The `=` character can be used as a shorthand for\n`return` when placed at the beginning of an expression.\n\n``` xml\n1 + 2 = \u003c?lua =1 + 2 ?\u003e\n```\n\nResult:\n\n\u003e \u003cdiv id=\"output\"\u003e\n\u003e\n\u003e 1 + 2 = 3\n\u003e\n\u003e \u003c/div\u003e\n\nThe filter tries to detect when the `return` has been omitted and\ninserts it automatically in that case. Therefore, the above can be\nshortened to\n\n``` xml\n1 + 2 = \u003c?lua 1 + 2 ?\u003e\n```\n\n\u003e \u003cdiv id=\"output\"\u003e\n\u003e\n\u003e 1 + 2 = 3\n\u003e\n\u003e \u003c/div\u003e\n\nRaw attributes syntax with format `run-lua` or `runlua` can be\nused as an alternative to the processing-instructions-based\nsyntax.\n\nFor example,\n\n``` markdown\n𝜋 ≈ `math.pi`{=run-lua}\n\n𝜏 ≈ `2 * math.pi`{=runlua}\n```\n\nyields\n\n\u003e \u003cdiv id=\"output\"\u003e\n\u003e\n\u003e 𝜋 ≈ 3.1415926535898\n\u003e\n\u003e 𝜏 ≈ 6.2831853071796\n\u003e\n\u003e \u003c/div\u003e\n\n**Note** that pandoc isn’t an XML processor, and the processing\ninstruction is terminated by a single `\u003e`. Use the “raw attribute”\nsyntax if your code contains that character:\n\n    ```{=runlua}\n    return 1 \u003e 0 and 'all is well'\n    ```\n\nUsage\n-----\n\nThe filter modifies the internal document representation; it can\nbe used with many publishing systems that are based on pandoc.\n\n### Plain pandoc\n\nPass the filter to pandoc via the `--lua-filter` (or `-L`) command\nline option.\n\n    pandoc --lua-filter run-lua.lua ...\n\n### Quarto\n\nUsers of Quarto can install this filter as an extension with\n\n    quarto install extension pandoc-ext/run-lua\n\nand use it by adding `run-lua` to the `filters` entry in their\nYAML header.\n\n``` yaml\n---\nfilters:\n  - run-lua\n---\n```\n\n### R Markdown\n\nUse `pandoc_args` to invoke the filter. See the [R Markdown\nCookbook](https://bookdown.org/yihui/rmarkdown-cookbook/lua-filters.html)\nfor details.\n\n``` yaml\n---\noutput:\n  word_document:\n    pandoc_args: ['--lua-filter=run-lua.lua']\n---\n```\n\nLicense\n-------\n\nThis pandoc Lua filter is published under the MIT license, see\nfile `LICENSE` for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandoc-ext%2Frun-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpandoc-ext%2Frun-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandoc-ext%2Frun-lua/lists"}