{"id":20235017,"url":"https://github.com/noredink/elm-formatted-text","last_synced_at":"2025-04-10T18:52:00.047Z","repository":{"id":57674652,"uuid":"96680887","full_name":"NoRedInk/elm-formatted-text","owner":"NoRedInk","description":"A type for representing formatted text","archived":false,"fork":false,"pushed_at":"2022-10-17T09:59:25.000Z","size":135,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T16:39:04.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/NoRedInk/elm-formatted-text/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NoRedInk.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":"2017-07-09T11:45:51.000Z","updated_at":"2022-10-17T09:59:28.000Z","dependencies_parsed_at":"2022-09-11T16:31:55.064Z","dependency_job_id":null,"html_url":"https://github.com/NoRedInk/elm-formatted-text","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoRedInk%2Felm-formatted-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoRedInk%2Felm-formatted-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoRedInk%2Felm-formatted-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoRedInk%2Felm-formatted-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NoRedInk","download_url":"https://codeload.github.com/NoRedInk/elm-formatted-text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248274421,"owners_count":21076386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-14T08:14:15.744Z","updated_at":"2025-04-10T18:52:00.013Z","avatar_url":"https://github.com/NoRedInk.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FormattedText\n\nThe `FormattedText` type represents some text with markup applied to it. The goal of this library is to make working with such text as easy as working with strings.\n\n## Creating FormattedText\nYou can create a FormattedText in a number of ways.\n\n- Use `formattedText` to combine a string with some formatting ranges. Ranges are allowed to overlap.\n- Use `fromString` to turn a string into an unformatted FormattedText.\n- Use `unchunk` to create a FormattedText from a list of chunks, pieces of text with homogeneous formatting.\n\n## Manipulating FormattedText\nAnything you can do with Strings you can do with FormattedText too,\nbecause this lib comes with equivalents of all functions from the core String and Regex modules.\n\n## Rendering FormattedText\nThe easiest way to render `FormattedText` into Html is using the `trees` function, which builds a markup tree from your `FormattedText`.\n\n```elm\nimport FormattedText exposing (..)\nimport Html exposing (Html)\n\ntype Markup = Bold | Italic\n\nview : FormattedText Markup -\u003e Html msg\nview formattedText =\n    Html.p [] (trees Html.text viewMarkup)\n\nviewMarkup : Markup -\u003e List (Html msg) -\u003e Html msg\nviewMarkup markup children =\n    case markup of\n        Bold -\u003e\n            Html.strong [] children\n\n        Italic -\u003e\n            Html.i [] children\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoredink%2Felm-formatted-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoredink%2Felm-formatted-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoredink%2Felm-formatted-text/lists"}