Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

Use new hexdocs URL format

author
Gears
committer
Louis Pilfold
date (Jun 3, 2026, 9:35 AM +0100) commit 7fd45a0a parent d11fd2a0 change-id oplvxrvu
+61 -51
+4
CHANGELOG.md
··· 6 6 7 7 ### Build tool 8 8 9 + - The build tool now generates Hexdocs URLs using the new format of 10 + `package.hexdocs.pm` rather than `hexdocs.pm/package`. 11 + ([Surya Rose](https://github.com/GearsDatapacks)) 12 + 9 13 ### Language server 10 14 11 15 ### Formatter
+4 -2
compiler-cli/src/new.rs
··· 176 176 } 177 177 178 178 pub fn default_readme(project_name: &str) -> String { 179 + let project_name_with_dashes = project_name.replace('_', "-"); 180 + 179 181 format!( 180 182 r#"# {project_name} 181 183 182 184 [![Package Version](https://img.shields.io/hexpm/v/{project_name})](https://hex.pm/packages/{project_name}) 183 - [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/{project_name}/) 185 + [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://{project_name_with_dashes}.hexdocs.pm/) 184 186 185 187 ```sh 186 188 gleam add {project_name}@1 ··· 193 195 }} 194 196 ``` 195 197 196 - Further documentation can be found at <https://hexdocs.pm/{project_name}>. 198 + Further documentation can be found at <https://{project_name_with_dashes}.hexdocs.pm/>. 197 199 198 200 ## Development 199 201
+6 -6
compiler-core/src/docs.rs
··· 110 110 path, 111 111 }); 112 112 113 - let host = if is_hex_publish == DocContext::HexPublish { 114 - "https://hexdocs.pm" 113 + let url = if is_hex_publish == DocContext::HexPublish { 114 + &format!("https://{}.hexdocs.pm", config.name.replace("_", "-")) 115 115 } else { 116 116 "" 117 117 }; ··· 175 175 project_version: &config.version.to_string(), 176 176 content: rendered_content, 177 177 rendering_timestamp: &rendering_timestamp, 178 - host, 178 + url, 179 179 unnest: &unnest, 180 180 }; 181 181 ··· 228 228 229 229 let template = ModuleTemplate { 230 230 gleam_version: COMPILER_VERSION, 231 - host, 231 + url, 232 232 unnest, 233 233 links: &links, 234 234 pages: &pages, ··· 652 652 struct PageTemplate<'a> { 653 653 gleam_version: &'a str, 654 654 unnest: &'a str, 655 - host: &'a str, 655 + url: &'a str, 656 656 page_title: &'a str, 657 657 page_meta_description: &'a str, 658 658 file_path: &'a Utf8PathBuf, ··· 670 670 struct ModuleTemplate<'a> { 671 671 gleam_version: &'a str, 672 672 unnest: String, 673 - host: &'a str, 673 + url: &'a str, 674 674 page_title: &'a str, 675 675 page_meta_description: &'a str, 676 676 file_path: &'a Utf8PathBuf,
+4 -1
compiler-core/src/docs/printer.rs
··· 648 648 kind: DependencyKind::Hex, 649 649 version, 650 650 }) => self.link( 651 - eco_format!("https://hexdocs.pm/{package}/{version}/{module}.html#{name}"), 651 + eco_format!( 652 + "https://{package}.hexdocs.pm/{version}/{module}.html#{name}", 653 + package = package.replace('_', "-") 654 + ), 652 655 qualified_name, 653 656 Some(title), 654 657 ),
+3 -3
compiler-core/src/docs/snapshots/gleam_core__docs__tests__canonical_link.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/LICENSE.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/LICENSE.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script> ··· 343 343 between multiple versions of the same package. --> 344 344 <script src="./docs_config.js"></script> 345 345 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 346 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 346 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 347 347 </head> 348 348 <body class="prewrap-off theme-light drawer-closed"> 349 349 <script> ··· 710 710 between multiple versions of the same package. --> 711 711 <script src="../../docs_config.js"></script> 712 712 <link id="syntax-theme" rel="stylesheet" href="../../css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 713 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/gleam/otp/actor.html" /> 713 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/gleam/otp/actor.html" /> 714 714 </head> 715 715 <body class="prewrap-off theme-light drawer-closed"> 716 716 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__discarded_arguments_are_not_shown.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__docs_of_a_type_constructor_are_not_used_by_the_following_function.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__hello_docs.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__ignored_argument_is_called_arg.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__internal_definitions_are_not_included.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__long_function_wrapping.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_function_comment_is_trimmed.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_module_comment_is_trimmed.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_standalone_pages_is_not_trimmed.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/one.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/one.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__tables.snap
··· 18 18 between multiple versions of the same package. --> 19 19 <script src="./docs_config.js"></script> 20 20 <link id="syntax-theme" rel="stylesheet" href="./css/atom-one-light.min.css?v=GLEAM_VERSION_HERE"/> 21 - <link rel="canonical" href="https://hexdocs.pm/test_project_name/app.html" /> 21 + <link rel="canonical" href="https://test-project-name.hexdocs.pm/app.html" /> 22 22 </head> 23 23 <body class="prewrap-off theme-light drawer-closed"> 24 24 <script>
+1 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__use_reexport_from_other_package.snap
··· 24 24 ---- VALUES 25 25 26 26 --- do_thing 27 - <pre><code>pub fn do_thing(value: <a href="https://hexdocs.pm/some_package/1.0.0/some_package/api.html#External" title="some_package/api.{type External}">api.External</a>) -> <a href="https://hexdocs.pm/some_package/1.0.0/some_package/api.html#External" title="some_package/api.{type External}">api.External</a></code></pre> 27 + <pre><code>pub fn do_thing(value: <a href="https://some-package.hexdocs.pm/1.0.0/some_package/api.html#External" title="some_package/api.{type External}">api.External</a>) -> <a href="https://some-package.hexdocs.pm/1.0.0/some_package/api.html#External" title="some_package/api.{type External}">api.External</a></code></pre>
+1 -1
compiler-core/templates/documentation_layout.html
··· 12 12 between multiple versions of the same package. --> 13 13 <script src="{{ unnest }}/docs_config.js"></script> 14 14 <link id="syntax-theme" rel="stylesheet" href="{{ unnest }}/css/atom-one-light.min.css?v={{ gleam_version }}"/> 15 - {% if !host.is_empty() && !project_name.is_empty() -%}<link rel="canonical" href="{{ host }}/{{ project_name|safe }}/{{ file_path|safe }}" />{%- endif %} 15 + {% if !url.is_empty() -%}<link rel="canonical" href="{{url|safe}}/{{ file_path|safe }}" />{%- endif %} 16 16 </head> 17 17 <body class="prewrap-off theme-light drawer-closed"> 18 18 <script>
+2 -2
hexpm/CONTRIBUTING.md
··· 3 3 ## Adding a New API Function 4 4 5 5 1. Figure out what you want to do 6 - - Go to https://hexdocs.pm/hex/Mix.Tasks.Hex.html and find what you want to do 6 + - Go to https://hex.hexdocs.pm/Mix.Tasks.Hex.html and find what you want to do 7 7 2. Once you find the page, click on the code icon on the top-right to go to the corresponding source code like so: https://github.com/hexpm/hex/blob/main/lib/mix/tasks/hex.owner.ex#L125 8 8 ```elixir 9 9 defp transfer_owner(organization, package, owner) do ··· 57 57 ``` 58 58 Note that the `api_key` and `config` fields will always be present in these request functions while the other fields are tailored to the specific request we want to make. 59 59 60 - 4. TODO: How to figure out what to write for the response function? 60 + 4. TODO: How to figure out what to write for the response function?
+3 -2
language-server/src/engine.rs
··· 2087 2087 module_name: &str, 2088 2088 name: Option<&str>, 2089 2089 ) -> String { 2090 + let package_name = package_name.replace('_', "-"); 2090 2091 let link = match name { 2091 - Some(name) => format!("https://hexdocs.pm/{package_name}/{module_name}.html#{name}"), 2092 - None => format!("https://hexdocs.pm/{package_name}/{module_name}.html"), 2092 + Some(name) => format!("https://{package_name}.hexdocs.pm/{module_name}.html#{name}"), 2093 + None => format!("https://{package_name}.hexdocs.pm/{module_name}.html"), 2093 2094 }; 2094 2095 format!("\nView on [HexDocs]({link})") 2095 2096 }
+1 -1
language-server/src/tests/hover.rs
··· 302 302 303 303 #[test] 304 304 fn hover_external_imported_function_nested_module() { 305 - // Example of HexDocs link with nested modules: https://hexdocs.pm/lustre/lustre/element/svg.html 305 + // Example of HexDocs link with nested modules: https://lustre.hexdocs.pm/lustre/element/svg.html 306 306 let code = " 307 307 import my/nested/example_module 308 308 fn main() {
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_contextual_type_expression.snap
··· 16 16 wobble.Wibble 17 17 ``` 18 18 19 - View on [HexDocs](https://hexdocs.pm/hex/wibble/wobble.html#Wibble) 19 + View on [HexDocs](https://hex.hexdocs.pm/wibble/wobble.html#Wibble)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_contextual_type_unqualified_import.snap
··· 12 12 Wobble 13 13 ``` 14 14 15 - View on [HexDocs](https://hexdocs.pm/hex/wibble/wobble.html#Wobble) 15 + View on [HexDocs](https://hex.hexdocs.pm/wibble/wobble.html#Wobble)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_function_with_another_value_same_name.snap
··· 16 16 Int 17 17 ``` 18 18 19 - View on [HexDocs](https://hexdocs.pm/hex/b/example_module.html#my_const) 19 + View on [HexDocs](https://hex.hexdocs.pm/b/example_module.html#my_const)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_constants.snap
··· 15 15 Int 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_const) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_const)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_ffi_renamed_function.snap
··· 15 15 fn() -> Nil 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_fn) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_fn)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_function.snap
··· 15 15 fn() -> Nil 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_fn) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_fn)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_function_nested_module.snap
··· 15 15 fn() -> Nil 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/my/nested/example_module.html#my_fn) 18 + View on [HexDocs](https://hex.hexdocs.pm/my/nested/example_module.html#my_fn)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_function_renamed_module.snap
··· 15 15 fn() -> Nil 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_fn) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_fn)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_unqualified_constants.snap
··· 15 15 Int 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_const) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_const)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_imported_unqualified_function.snap
··· 15 15 fn() -> Nil 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_fn) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_fn)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_unqualified_imported_function_renamed_module.snap
··· 15 15 fn() -> Nil 16 16 ``` 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_fn) 18 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_fn)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_external_value_with_two_modules_same_name.snap
··· 16 16 Int 17 17 ``` 18 18 19 - View on [HexDocs](https://hexdocs.pm/hex/b/example_module.html#my_const) 19 + View on [HexDocs](https://hex.hexdocs.pm/b/example_module.html#my_const)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_import_unqualified_value_from_hex.snap
··· 17 17 Exciting documentation 18 18 Maybe even multiple lines 19 19 20 - View on [HexDocs](https://hexdocs.pm/hex/example_module.html#my_num) 20 + View on [HexDocs](https://hex.hexdocs.pm/example_module.html#my_num)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_over_imported_module.snap
··· 15 15 Here is some documentation about it. 16 16 This module does stuff 17 17 18 - View on [HexDocs](https://hexdocs.pm/hex/wibble.html) 18 + View on [HexDocs](https://hex.hexdocs.pm/wibble.html)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_over_module_name.snap
··· 19 19 Here is some documentation about it. 20 20 This module does stuff 21 21 22 - View on [HexDocs](https://hexdocs.pm/hex/wibble.html) 22 + View on [HexDocs](https://hex.hexdocs.pm/wibble.html)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_over_module_name_in_annotation.snap
··· 19 19 Here is some documentation about it. 20 20 This module does stuff 21 21 22 - View on [HexDocs](https://hexdocs.pm/hex/wibble.html) 22 + View on [HexDocs](https://hex.hexdocs.pm/wibble.html)
+1 -1
language-server/src/tests/snapshots/gleam_language_server__tests__hover__hover_over_module_with_path.snap
··· 17 17 ``` 18 18 The module documentation 19 19 20 - View on [HexDocs](https://hexdocs.pm/hex/wibble/wobble.html) 20 + View on [HexDocs](https://hex.hexdocs.pm/wibble/wobble.html)
+2 -2
test-community-packages/README.md
··· 1 1 # test_community_packages 2 2 3 3 [![Package Version](https://img.shields.io/hexpm/v/test_community_packages)](https://hex.pm/packages/test_community_packages) 4 - [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/test_community_packages/) 4 + [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://test-community-packages.hexdocs.pm/) 5 5 6 6 ```sh 7 7 gleam add test_community_packages ··· 14 14 } 15 15 ``` 16 16 17 - Further documentation can be found at <https://hexdocs.pm/test_community_packages>. 17 + Further documentation can be found at <https://test-community-packages.hexdocs.pm>. 18 18 19 19 ## Development 20 20
+2 -2
test/publishing_default_readme/README.md
··· 1 1 # default_readme 2 2 3 3 [![Package Version](https://img.shields.io/hexpm/v/default_readme)](https://hex.pm/packages/default_readme) 4 - [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/default_readme/) 4 + [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://default-readme.hexdocs.pm/) 5 5 6 6 ```sh 7 7 gleam add default_readme@1 ··· 14 14 } 15 15 ``` 16 16 17 - Further documentation can be found at <https://hexdocs.pm/default_readme>. 17 + Further documentation can be found at <https://default-readme.hexdocs.pm>. 18 18 19 19 ## Development 20 20