-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocs.json
More file actions
1 lines (1 loc) · 3.85 KB
/
docs.json
File metadata and controls
1 lines (1 loc) · 3.85 KB
1
[{"name":"HtmlToElm","comment":"\n\n\n## Running Through elm-review\n\n@docs rule\n\n\n## Running Directly From Elm\n\n@docs htmlToElm\n\n","unions":[],"aliases":[],"values":[{"name":"htmlToElm","comment":" If you're using this through `elm-review`, you won't need this function. This is a lower-level function to convert\nan HTML String into an Elm String.\n","type":"HtmlToElm.Config.Config -> String.String -> String.String"},{"name":"rule","comment":" Generates Elm code from HTML Strings\n\n config =\n [ HtmlToElm.rule\n ]\n\n\n## Before fix\n\nThe fix runs on top-level values with an Html type annotation. It turns the HTML within the String\nin a `Debug.todo` call into compiling Elm code!\n\n import Html\n import Html.Attributes as Attr\n\n navbarView : Html msg\n navbarView =\n Debug.todo \"\"\"<ul class=\"flex\"><li><a href=\"/\">Home</a></li></ul>\"\"\"\n\n\n## After fix\n\n import Html\n import Html.Attributes as Attr\n\n navbarView : Html msg\n navbarView =\n Html.ul\n [ Attr.class \"flex\"\n ]\n [ Html.li []\n [ Html.a\n [ Attr.href \"/\"\n ]\n [ Html.text \"Home\" ]\n ]\n ]\n\nNote that the imports in our module are used for the auto-generated Elm code.\nSo be sure to set up your imports the way you like them before scaffolding a HTML code!\n\n\n## With `elm-tailwind-modules`\n\nIf your imports include modules from [`elm-tailwind-modules`](https://github.com/matheus23/elm-tailwind-modules),\nthen this fix will turn your `class` attributes into `elm-tailwind-modules` attributes.\n\n import Html.Styled exposing (..)\n import Html.Styled.Attributes as Attr\n import Tailwind.Breakpoints as Bp\n import Tailwind.Utilities as Tw\n\n navbarView : Html msg\n navbarView =\n Debug.todo \"\"\"<ul><li><a href=\"/\">Home</a></li></ul>\"\"\"\n\n\n## After fix\n\n import Html.Styled exposing (..)\n import Html.Styled.Attributes as Attr\n import Tailwind.Breakpoints\n import Tailwind.Utilities\n\n navbarView : Html msg\n navbarView =\n Html.ul\n [ Attr.css\n [ Tailwind.Utilities.flex\n ]\n ]\n [ Html.li []\n [ Html.a\n [ Attr.href \"/\"\n ]\n [ text \"Home\" ]\n ]\n ]\n\nNote that the example that first example didn't have `import Tailwind.Utilities`, and therefore `class=\"flex\"` was\ninterpreted as a plain CSS class, not a Tailwind class.\n\n\n## Try it out\n\nYou can try this rule out by running the following command:\n\n```bash\nelm-review --template dillonkearns/elm-review-html-to-elm/example --rules HtmlToElm\n```\n\n","type":"Review.Rule.Rule"}],"binops":[]},{"name":"HtmlToElm.Config","comment":" If you're running this through the `elm-review` Rule, you won't need this Config. It infers the config from\nthe context of the file it applies the fix to for the `elm-review` Rule. If you are running the more low-level helper\n[`HtmlToElm.htmlToElm`](HtmlToElm.htmlToElm) directly then you will need to pass it a config.\n\n@docs Config, Exposing\n\n@docs default\n\n","unions":[{"name":"Exposing","comment":" ","args":[],"cases":[["All",[]],["None",[]],["Some",["List.List String.String"]]]}],"aliases":[{"name":"Config","comment":" ","args":[],"type":"{ html : ( String.String, HtmlToElm.Config.Exposing ), htmlAttr : ( String.String, HtmlToElm.Config.Exposing ), svg : ( String.String, HtmlToElm.Config.Exposing ), svgAttr : ( String.String, HtmlToElm.Config.Exposing ), tw : ( String.String, HtmlToElm.Config.Exposing ), bp : ( String.String, HtmlToElm.Config.Exposing ), useTailwindModules : Basics.Bool }"}],"values":[{"name":"default","comment":" ","type":"HtmlToElm.Config.Config"}],"binops":[]}]