{"id":40596625,"url":"https://github.com/ute/search-replace","last_synced_at":"2026-01-21T04:03:12.275Z","repository":{"id":167340062,"uuid":"642893020","full_name":"ute/search-replace","owner":"ute","description":"quarto filter extension for simple search-replace macros","archived":false,"fork":false,"pushed_at":"2025-12-29T21:35:30.000Z","size":55,"stargazers_count":26,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T04:17:00.625Z","etag":null,"topics":["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/ute.png","metadata":{"files":{"readme":"README.md","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":"2023-05-19T15:27:42.000Z","updated_at":"2025-12-29T21:35:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9b527ca-9c11-4cb2-9869-8bfa5e4aad6f","html_url":"https://github.com/ute/search-replace","commit_stats":null,"previous_names":["ute/search-replace"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ute/search-replace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ute%2Fsearch-replace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ute%2Fsearch-replace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ute%2Fsearch-replace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ute%2Fsearch-replace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ute","download_url":"https://codeload.github.com/ute/search-replace/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ute%2Fsearch-replace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28625926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["quarto","quarto-extension","quarto-filter"],"created_at":"2026-01-21T04:03:11.727Z","updated_at":"2026-01-21T04:03:12.267Z","avatar_url":"https://github.com/ute.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Search-replace Extension for Quarto\n\nQuarto filter extension that lets you automatically search and replace strings in quarto document when rendering, in a similar way as simple LaTeX text macros.\n\nDefine pairs of search string and replacement in the document yaml, and let quarto do the work. The filter searches document text, including link targets. Replacements may include markdown text modifiers (emphasis) and math inline formulae.\n\n#### News:\n\n- **Format dependent** replacements are possible now for all formats that are detectable by quarto extensions, notably pdf and html, see the [quarto documentation](https://quarto.org/docs/extensions/lua-api.html#format-detection)\n\n- For long lists of replacements, check out extension [`mergemeta`](https://github.com/ute/mergemeta), which allows you to merge in data stored under a different key (not `search-replace`) in another `yaml` file, see under Section [Tip](#tip-pre-defined-abbreviations-in-separate-files)\n\n## Installing\n\n```bash\nquarto add ute/search-replace\n```\n\nThis will install the extension under the `_extensions` subdirectory.\nIf you're using version control, you will want to check in this directory.\n\n## Using\n\nInclude the filter in the document's yaml, and add a key `search-replace`. Under this key, define your search-replace pairs as subkeys in the form `search : replace`. It is a good idea to start the search key with a special character, such as \"+\" or \".\", although it is not required.\n\nUpon rendering, every string or sub-string that matches a search key will be replaced in the main text, and in link targets. Search keys should not be contained in each other - this would give ambiguous results.\n\nThere are some reserved keys (currently only one, but more may be added) that start with `--`:\n\n- `--when-format--` is used to specify abbreviations that are only rendered when the document format matches the following sub-key.\n\n### Example:\nWith the yaml\n```yaml\n---\nformat: html\nfilters:\n  - search-replace\nsearch-replace:\n  +quarto: \"[Quarto](https://quarto.org)\"\n  +qurl  : https://quarto.org/docs\n  +forml : $\\alpha * \\beta = \\gamma$\n  +pyth  : \"*Pythagoras' theorem*: $a^2 + b^2 = \\\\dots$\"\n  .doo   : \"- doodledoo - \"\n--when-format--:\n    html:\n      +br    :  \"`\u003cbr\u003e`{=html}\"\n      +format: html\n      +wewant: \"read on screen\"  \n    pdf:  \n      +br    : \"`\\\\newline`{=latex}\"\n      +format: pdf\n      +wewant: \"print on paper\"  \n  +dab   : \"**dab**\"\n  \"!dua\" : \"`duaaah`\"\n---  \n```\ndocument text\n```text\n+quarto allows us to write beautiful texts \nabout +pyth or similar complicated formulas (e.g. +forml), \nand to [create our *own* filters](+qurl/extensions/filters.html). +br\nEven filters that replace text:+br .doo+dab+dab+dab!dua, +dab!dua!\n\nSince we wanted to +wewant, we chose to render as +form.\n```\ngets rendered, if html, as\n\n\u003e [Quarto](https://quarto.org) allows us to write beautiful texts about *Pythagoras' theorem*: $a^2 + b^2 = \\dots$ or similar complicated formulas (e.g. $\\alpha * \\beta = \\gamma$), and to [create our *own* filters](https://quarto.org/docs/extensions/filters.html). \u003cbr\u003e \nEven filters that replace text:\u003cbr\u003e\n\\- doodledoo -**dabdabdab**`duaaah`, **dab**`duaaah`!\n\u003e \n\u003e Since we wanted to read on screen, we chose to render as html.\n\n## Known quirks\n\n- search keys and replacement strings that can be interpreted as yaml because of special characters such as `:`,  or leading  `-`,`` ` ``,`[`, `!`, have to be enquoted. To be on the safe side, you can just enquote all replacement strings.\n- backslashes in LaTeX formulae have to be escaped with a second backslash if and only if the containing string is enquoted.\n\n\n## Example\n\nHere is the source code for a minimal example: [example.qmd](example.qmd).\n\n## Tip: pre-defined abbreviations in separate files \n\nStore long lists of search-replace items in an extra yaml file and include it in the documents yaml using the `metadata-files` key.\nWith the [`mergemeta`](https://github.com/ute/mergemeta) extension, the abbreviations can be merged into the `search-replace` key. This avoids overwriting document specific abbreviations, and allows to combine multiple abbreviation sources files.\n\nFor example, file [`myabbreviations.yml`](myabbreviations.yml) contains search-replace definitions stored under `mystuff`:\n\n```yml\nmystuff:\n  +quarto: \"[Quarto](https://quarto.org)\"\n  +qurl  : https://quarto.org/docs\n# etc  \n```\n and can be used in qmd document [`mergemeta-example.qmd`](mergemeta-example.qmd) with the yaml header\n \n```yml\n---\nformat: html\nfilters:\n  - mergemeta\n  - search-replace\nmetadata-files: \n  - myabbreviations.yml # defines mystuff\n\nmergemeta:\n   search-replace: mystuff\n---  \n```\n\nMake sure to list filter `mergemeta` before `search-replace`.\n\n## Acknowledgement\n\n [Scott Koga-Browes](https://github.com/scokobro)' lovely python-based pandoc filter [pandoc-abbreviations](https://github.com/scokobro/pandoc-abbreviations) that replaces text strings (not links) inspired me to write this quarto extension. He requires the search keys to start with a \"+\" sign which gives a nice and clear appearance - they are easy to spot in the source text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fute%2Fsearch-replace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fute%2Fsearch-replace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fute%2Fsearch-replace/lists"}