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

Configure Feed

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

Print links to types in documentation

+211 -95
+10 -21
compiler-core/src/docs.rs
··· 153 153 type_: SearchItemType::Page, 154 154 parent_title: config.name.to_string(), 155 155 title: config.name.to_string(), 156 - content, 156 + content: escape_html_content(content), 157 157 reference: page.path.to_string(), 158 158 }) 159 159 } ··· 170 170 let rendered_documentation = 171 171 render_markdown(&documentation_content.clone(), MarkdownSource::Comment); 172 172 173 - let mut printer = Printer::new(&module.ast.names); 173 + let mut printer = Printer::new( 174 + module.ast.type_info.package.clone(), 175 + module.name.clone(), 176 + &module.ast.names, 177 + ); 174 178 175 179 let types: Vec<TypeDefinition<'_>> = module 176 180 .ast 177 181 .definitions 178 182 .iter() 179 - .filter(|statement| !statement.is_internal()) 180 - .flat_map(|statement| printer.type_definition(&source_links, statement)) 183 + .filter_map(|statement| printer.type_definition(&source_links, statement)) 181 184 .sorted() 182 185 .collect(); 183 186 ··· 185 188 .ast 186 189 .definitions 187 190 .iter() 188 - .filter(|statement| !statement.is_internal()) 189 - .flat_map(|statement| printer.value(&source_links, statement)) 191 + .filter_map(|statement| printer.value(&source_links, statement)) 190 192 .sorted() 191 193 .collect(); 192 194 ··· 351 353 }); 352 354 353 355 let search_data_json = serde_to_string(&SearchData { 354 - items: escape_html_contents(search_items), 356 + items: search_items, 355 357 programming_language: SearchProgrammingLanguage::Gleam, 356 358 }) 357 359 .expect("search index serialization"); ··· 518 520 ); 519 521 } 520 522 521 - fn escape_html_contents(indexes: Vec<SearchItem>) -> Vec<SearchItem> { 522 - indexes 523 - .into_iter() 524 - .map(|idx| SearchItem { 525 - type_: idx.type_, 526 - parent_title: idx.parent_title, 527 - title: idx.title, 528 - content: escape_html_content(idx.content), 529 - reference: idx.reference, 530 - }) 531 - .collect::<Vec<SearchItem>>() 532 - } 533 - 534 523 fn import_synonyms(parent: &str, child: &str) -> String { 535 524 format!("Synonyms:\n{parent}.{child}\n{parent} {child}") 536 525 } ··· 542 531 .unwrap_or_else(|| "".into()); 543 532 544 533 // TODO: parse markdown properly and extract the text nodes 545 - raw_text.replace("```gleam", "").replace("```", "") 534 + escape_html_content(raw_text.replace("```gleam", "").replace("```", "")) 546 535 } 547 536 548 537 fn markdown_documentation(doc: &Option<(u32, EcoString)>) -> String {
+125 -49
compiler-core/src/docs/printer.rs
··· 3 3 ops::Deref, 4 4 }; 5 5 6 - use ecow::EcoString; 6 + use ecow::{EcoString, eco_format}; 7 7 use itertools::Itertools; 8 8 9 9 use crate::{ ··· 13 13 TypedRecordConstructor, 14 14 }, 15 15 docvec, 16 - pretty::{Document, Documentable, break_, join, line, nil}, 17 - type_::{Deprecation, Type, TypeVar, printer::Names}, 16 + pretty::{Document, Documentable, break_, join, line, nil, zero_width_string}, 17 + type_::{ 18 + Deprecation, PRELUDE_MODULE_NAME, PRELUDE_PACKAGE_NAME, Type, TypeVar, printer::Names, 19 + }, 18 20 }; 19 21 20 22 use super::{ ··· 24 26 25 27 pub struct Printer<'a> { 26 28 names: &'a Names, 29 + package: EcoString, 30 + module: EcoString, 27 31 printed_type_variables: HashMap<u64, EcoString>, 28 32 printed_type_variable_names: HashSet<EcoString>, 29 33 uid: u64, 30 34 } 31 35 32 36 impl Printer<'_> { 33 - pub fn new<'a>(names: &'a Names) -> Printer<'a> { 37 + pub fn new<'a>(package: EcoString, module: EcoString, names: &'a Names) -> Printer<'a> { 34 38 Printer { 35 39 names, 40 + package, 41 + module, 36 42 printed_type_variables: HashMap::new(), 37 43 printed_type_variable_names: HashSet::new(), 38 44 uid: 0, ··· 64 70 Deprecation::NotDeprecated => "".to_string(), 65 71 Deprecation::Deprecated { message } => message.to_string(), 66 72 }, 67 - constructors: constructors 68 - .iter() 69 - .map(|constructor| TypeConstructor { 70 - definition: print(self.record_constructor(constructor)), 71 - documentation: markdown_documentation(&constructor.documentation), 72 - text_documentation: text_documentation(&constructor.documentation), 73 - arguments: constructor 74 - .arguments 75 - .iter() 76 - .filter_map(|arg| arg.label.as_ref().map(|(_, label)| (arg, label))) 77 - .map(|(argument, label)| TypeConstructorArg { 78 - name: label.trim_end().to_string(), 79 - doc: markdown_documentation(&argument.doc), 80 - }) 81 - .filter(|arg| !arg.doc.is_empty()) 82 - .collect(), 83 - }) 84 - .collect(), 73 + constructors: if *opaque { 74 + Vec::new() 75 + } else { 76 + constructors 77 + .iter() 78 + .map(|constructor| TypeConstructor { 79 + definition: print(self.record_constructor(constructor)), 80 + documentation: markdown_documentation(&constructor.documentation), 81 + text_documentation: text_documentation(&constructor.documentation), 82 + arguments: constructor 83 + .arguments 84 + .iter() 85 + .filter_map(|arg| arg.label.as_ref().map(|(_, label)| (arg, label))) 86 + .map(|(argument, label)| TypeConstructorArg { 87 + name: label.trim_end().to_string(), 88 + doc: markdown_documentation(&argument.doc), 89 + }) 90 + .filter(|arg| !arg.doc.is_empty()) 91 + .collect(), 92 + }) 93 + .collect() 94 + }, 85 95 source_url: source_links.url(*location), 86 96 opaque: *opaque, 87 97 }), ··· 174 184 let arguments = if parameters.is_empty() { 175 185 nil() 176 186 } else { 177 - Self::wrap_arguments(parameters.iter().map(|(_, parameter)| parameter.to_doc())) 187 + Self::wrap_arguments( 188 + parameters 189 + .iter() 190 + .map(|(_, parameter)| self.variable(parameter)), 191 + ) 178 192 }; 179 193 180 194 let keywords = if opaque { "opaque type " } else { "type " }; 181 195 182 - let type_head = docvec!["pub ", keywords, name, arguments]; 196 + let type_head = docvec![ 197 + self.keyword("pub "), 198 + self.keyword(keywords), 199 + self.title(name), 200 + arguments 201 + ]; 183 202 184 - if constructors.is_empty() { 203 + if constructors.is_empty() || opaque { 185 204 return type_head; 186 205 } 187 206 ··· 202 221 constructor: &'a TypedRecordConstructor, 203 222 ) -> Document<'a> { 204 223 if constructor.arguments.is_empty() { 205 - return constructor.name.as_str().to_doc(); 224 + return self.title(&constructor.name); 206 225 } 207 226 208 227 let arguments = constructor.arguments.iter().map( 209 228 |RecordConstructorArg { label, type_, .. }| match label { 210 - Some((_, label)) => label.to_doc().append(": ").append(self.type_(type_)), 229 + Some((_, label)) => self.variable(label).append(": ").append(self.type_(type_)), 211 230 None => self.type_(type_), 212 231 }, 213 232 ); 214 233 215 - constructor 216 - .name 217 - .as_str() 218 - .to_doc() 219 - .append(Self::wrap_arguments(arguments)) 234 + let arguments = Self::wrap_arguments(arguments); 235 + 236 + docvec![self.title(&constructor.name), arguments] 220 237 } 221 238 222 239 fn type_alias<'a>( ··· 228 245 let parameters = if parameters.is_empty() { 229 246 nil() 230 247 } else { 231 - let arguments = parameters.iter().map(|(_, parameter)| parameter.to_doc()); 248 + let arguments = parameters 249 + .iter() 250 + .map(|(_, parameter)| self.variable(parameter)); 232 251 Self::wrap_arguments(arguments) 233 252 }; 234 253 235 254 docvec![ 236 - "pub type ", 237 - name, 255 + self.keyword("pub type "), 256 + self.title(name), 238 257 parameters, 239 258 break_(" =", " = "), 240 259 self.type_(type_).nest(INDENT) ··· 242 261 } 243 262 244 263 fn constant<'a>(&mut self, name: &'a str, type_: &Type) -> Document<'a> { 245 - docvec!["pub const ", name, ": ", self.type_(type_)] 264 + docvec![ 265 + self.keyword("pub const "), 266 + self.title(name), 267 + ": ", 268 + self.type_(type_) 269 + ] 246 270 } 247 271 248 272 fn function_signature<'a>( ··· 252 276 return_type: &Type, 253 277 ) -> Document<'a> { 254 278 let arguments = arguments.iter().map(|argument| { 255 - let name = self.argument_name(argument); 279 + let name = self.variable(self.argument_name(argument)); 256 280 docvec![name, ": ", self.type_(&argument.type_)].group() 257 281 }); 282 + let arguments = Self::wrap_arguments(arguments); 258 283 259 284 docvec![ 260 - "pub fn ", 261 - name, 262 - Self::wrap_arguments(arguments), 285 + self.keyword("pub fn "), 286 + self.title(name), 287 + arguments, 263 288 " -> ", 264 289 self.type_(return_type) 265 290 ] ··· 301 326 302 327 fn type_(&mut self, type_: &Type) -> Document<'static> { 303 328 match type_ { 304 - Type::Named { name, args, .. } => { 329 + Type::Named { 330 + package, 331 + module, 332 + name, 333 + args, 334 + .. 335 + } => { 336 + let name = self.named_type_name(package, module, name); 305 337 if args.is_empty() { 306 - name.clone().to_doc() 338 + name 307 339 } else { 308 - name.clone().to_doc().append(Self::type_arguments( 340 + name.append(Self::type_arguments( 309 341 args.iter().map(|argument| self.type_(argument)), 310 342 )) 311 343 } 312 344 } 313 345 Type::Fn { args, return_ } => docvec![ 314 - "fn", 346 + self.keyword("fn"), 315 347 Self::type_arguments(args.iter().map(|argument| self.type_(argument))), 316 348 " -> ", 317 349 self.type_(return_) ··· 323 355 Type::Var { type_ } => match type_.as_ref().borrow().deref() { 324 356 TypeVar::Link { type_ } => self.type_(type_), 325 357 326 - TypeVar::Unbound { id } | TypeVar::Generic { id } => self.type_variable(*id), 358 + TypeVar::Unbound { id } | TypeVar::Generic { id } => { 359 + let name = self.type_variable(*id); 360 + self.variable(name) 361 + } 327 362 }, 328 363 } 329 364 } 330 365 331 - fn type_variable(&mut self, id: u64) -> Document<'static> { 366 + fn type_variable(&mut self, id: u64) -> EcoString { 332 367 if let Some(name) = self.names.get_type_variable(id) { 333 - return name.clone().to_doc(); 368 + return name.clone(); 334 369 } 335 370 336 371 if let Some(name) = self.printed_type_variables.get(&id) { 337 - return name.clone().to_doc(); 372 + return name.clone(); 338 373 } 339 374 340 375 loop { ··· 342 377 if !self.printed_type_variable_names.contains(&name) { 343 378 _ = self.printed_type_variable_names.insert(name.clone()); 344 379 _ = self.printed_type_variables.insert(id, name.clone()); 345 - return name.to_doc(); 380 + return name; 346 381 } 382 + } 383 + } 384 + 385 + fn named_type_name(&self, package: &str, module: &str, name: &EcoString) -> Document<'static> { 386 + if package == PRELUDE_PACKAGE_NAME && module == PRELUDE_MODULE_NAME { 387 + self.title(name) 388 + } else if package == self.package && module == self.module { 389 + self.link(eco_format!("#{name}"), self.title(name)) 390 + } else { 391 + self.link( 392 + eco_format!("https://hexdocs.pm/{package}/{module}.html#{name}"), 393 + self.title(name), 394 + ) 347 395 } 348 396 } 349 397 ··· 367 415 368 416 self.uid += 1; 369 417 chars.into_iter().rev().collect() 418 + } 419 + 420 + fn keyword<'a>(&self, keyword: impl Documentable<'a>) -> Document<'a> { 421 + keyword.to_doc().surround( 422 + zero_width_string(r#"<span class="hljs-keyword">"#.into()), 423 + zero_width_string("</span>".into()), 424 + ) 425 + } 426 + 427 + fn title<'a>(&self, name: impl Documentable<'a>) -> Document<'a> { 428 + name.to_doc().surround( 429 + zero_width_string(r#"<span class="hljs-title">"#.into()), 430 + zero_width_string("</span>".into()), 431 + ) 432 + } 433 + 434 + fn variable<'a>(&self, name: impl Documentable<'a>) -> Document<'a> { 435 + name.to_doc().surround( 436 + zero_width_string(r#"<span class="hljs-variable">"#.into()), 437 + zero_width_string("</span>".into()), 438 + ) 439 + } 440 + 441 + fn link<'a>(&self, href: EcoString, name: impl Documentable<'a>) -> Document<'a> { 442 + name.to_doc().surround( 443 + zero_width_string(eco_format!(r#"<a href="{href}">"#)), 444 + zero_width_string("</a>".into()), 445 + ) 370 446 } 371 447 } 372 448
+11 -2
compiler-core/src/docs/snapshots/gleam_core__docs__tests__canonical_link.snap
··· 311 311 elem.classList.add("gleam"); 312 312 } 313 313 }); 314 + hljs.configure({ 315 + cssSelector: 'pre code:not(.hljs-ignore)' 316 + }) 314 317 hljs.highlightAll(); 315 318 </script> 316 319 ··· 595 598 596 599 </div> 597 600 598 - <pre><code class="hljs gleam">pub fn one() -&gt; Int</code></pre> 601 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre> 599 602 600 603 <div class="rendered-markdown"><p>Here is some documentation</p> 601 604 </div> ··· 675 678 elem.classList.add("gleam"); 676 679 } 677 680 }); 681 + hljs.configure({ 682 + cssSelector: 'pre code:not(.hljs-ignore)' 683 + }) 678 684 hljs.highlightAll(); 679 685 </script> 680 686 ··· 959 965 960 966 </div> 961 967 962 - <pre><code class="hljs gleam">pub fn one() -&gt; Int</code></pre> 968 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre> 963 969 964 970 <div class="rendered-markdown"><p>Here is some documentation</p> 965 971 </div> ··· 1039 1045 elem.classList.add("gleam"); 1040 1046 } 1041 1047 }); 1048 + hljs.configure({ 1049 + cssSelector: 'pre code:not(.hljs-ignore)' 1050 + }) 1042 1051 hljs.highlightAll(); 1043 1052 </script> 1044 1053
+4 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__discarded_arguments_are_not_shown.snap
··· 264 264 265 265 </div> 266 266 267 - <pre><code class="hljs gleam">pub fn discard(discarded: a) -&gt; Int</code></pre> 267 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">discard</span>(<span class="hljs-variable">discarded</span>: <span class="hljs-variable">a</span>) -> <span class="hljs-title">Int</span></code></pre> 268 268 269 269 <div class="rendered-markdown"></div> 270 270 </div> ··· 343 343 elem.classList.add("gleam"); 344 344 } 345 345 }); 346 + hljs.configure({ 347 + cssSelector: 'pre code:not(.hljs-ignore)' 348 + }) 346 349 hljs.highlightAll(); 347 350 </script> 348 351
+7 -4
compiler-core/src/docs/snapshots/gleam_core__docs__tests__docs_of_a_type_constructor_are_not_used_by_the_following_function.snap
··· 272 272 273 273 <div class="custom-type-constructors"> 274 274 <div class="rendered-markdown"></div> 275 - <pre><code class="hljs gleam">pub type Wibble { 276 - Wobble(wabble: Int) 275 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub </span><span class="hljs-keyword">type </span><span class="hljs-title">Wibble</span> { 276 + <span class="hljs-title">Wobble</span>(<span class="hljs-variable">wabble</span>: <span class="hljs-title">Int</span>) 277 277 }</code></pre> 278 278 279 279 <h3> ··· 284 284 <li class="constructor-item"> 285 285 <div class="constructor-row"> 286 286 <svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg> 287 - <pre class="constructor-name"><code class="hljs gleam">Wobble(wabble: Int)</code></pre> 287 + <pre class="constructor-name"><code class="hljs gleam hljs-ignore"><span class="hljs-title">Wobble</span>(<span class="hljs-variable">wabble</span>: <span class="hljs-title">Int</span>)</code></pre> 288 288 </div> 289 289 290 290 <div class="constructor-item-docs"> ··· 335 335 336 336 </div> 337 337 338 - <pre><code class="hljs gleam">pub fn main() -&gt; a</code></pre> 338 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">main</span>() -> <span class="hljs-variable">a</span></code></pre> 339 339 340 340 <div class="rendered-markdown"></div> 341 341 </div> ··· 414 414 elem.classList.add("gleam"); 415 415 } 416 416 }); 417 + hljs.configure({ 418 + cssSelector: 'pre code:not(.hljs-ignore)' 419 + }) 417 420 hljs.highlightAll(); 418 421 </script> 419 422
+4 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__hello_docs.snap
··· 264 264 265 265 </div> 266 266 267 - <pre><code class="hljs gleam">pub fn one() -&gt; Int</code></pre> 267 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre> 268 268 269 269 <div class="rendered-markdown"><p>Here is some documentation</p> 270 270 </div> ··· 344 344 elem.classList.add("gleam"); 345 345 } 346 346 }); 347 + hljs.configure({ 348 + cssSelector: 'pre code:not(.hljs-ignore)' 349 + }) 347 350 hljs.highlightAll(); 348 351 </script> 349 352
+4 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__ignored_argument_is_called_arg.snap
··· 264 264 265 265 </div> 266 266 267 - <pre><code class="hljs gleam">pub fn one(arg: a) -&gt; Int</code></pre> 267 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>(<span class="hljs-variable">arg</span>: <span class="hljs-variable">a</span>) -> <span class="hljs-title">Int</span></code></pre> 268 268 269 269 <div class="rendered-markdown"></div> 270 270 </div> ··· 343 343 elem.classList.add("gleam"); 344 344 } 345 345 }); 346 + hljs.configure({ 347 + cssSelector: 'pre code:not(.hljs-ignore)' 348 + }) 346 349 hljs.highlightAll(); 347 350 </script> 348 351
+3
compiler-core/src/docs/snapshots/gleam_core__docs__tests__internal_definitions_are_not_included.snap
··· 313 313 elem.classList.add("gleam"); 314 314 } 315 315 }); 316 + hljs.configure({ 317 + cssSelector: 'pre code:not(.hljs-ignore)' 318 + }) 316 319 hljs.highlightAll(); 317 320 </script> 318 321
+12 -9
compiler-core/src/docs/snapshots/gleam_core__docs__tests__long_function_wrapping.snap
··· 272 272 273 273 <div class="custom-type-constructors"> 274 274 <div class="rendered-markdown"></div> 275 - <pre><code class="hljs gleam">pub type Option(t) { 276 - Some(t) 277 - None 275 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub </span><span class="hljs-keyword">type </span><span class="hljs-title">Option</span>(<span class="hljs-variable">t</span>) { 276 + <span class="hljs-title">Some</span>(<span class="hljs-variable">t</span>) 277 + <span class="hljs-title">None</span> 278 278 }</code></pre> 279 279 280 280 <h3> ··· 285 285 <li class="constructor-item"> 286 286 <div class="constructor-row"> 287 287 <svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg> 288 - <pre class="constructor-name"><code class="hljs gleam">Some(t)</code></pre> 288 + <pre class="constructor-name"><code class="hljs gleam hljs-ignore"><span class="hljs-title">Some</span>(<span class="hljs-variable">t</span>)</code></pre> 289 289 </div> 290 290 291 291 <div class="constructor-item-docs"> ··· 298 298 <li class="constructor-item"> 299 299 <div class="constructor-row"> 300 300 <svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg> 301 - <pre class="constructor-name"><code class="hljs gleam">None</code></pre> 301 + <pre class="constructor-name"><code class="hljs gleam hljs-ignore"><span class="hljs-title">None</span></code></pre> 302 302 </div> 303 303 304 304 <div class="constructor-item-docs"> ··· 333 333 334 334 </div> 335 335 336 - <pre><code class="hljs gleam">pub fn lazy_or( 337 - first: Option(a), 338 - second: fn() -&gt; Option(a), 339 - ) -&gt; Option(a)</code></pre> 336 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">lazy_or</span>( 337 + <span class="hljs-variable">first</span>: <a href="#Option"><span class="hljs-title">Option</span></a>(<span class="hljs-variable">a</span>), 338 + <span class="hljs-variable">second</span>: <span class="hljs-keyword">fn</span>() -> <a href="#Option"><span class="hljs-title">Option</span></a>(<span class="hljs-variable">a</span>), 339 + ) -> <a href="#Option"><span class="hljs-title">Option</span></a>(<span class="hljs-variable">a</span>)</code></pre> 340 340 341 341 <div class="rendered-markdown"><p>Returns the first value if it is <code>Some</code>, otherwise evaluates the given 342 342 function for a fallback value.</p> ··· 417 417 elem.classList.add("gleam"); 418 418 } 419 419 }); 420 + hljs.configure({ 421 + cssSelector: 'pre code:not(.hljs-ignore)' 422 + }) 420 423 hljs.highlightAll(); 421 424 </script> 422 425
+4 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_function_comment_is_trimmed.snap
··· 264 264 265 265 </div> 266 266 267 - <pre><code class="hljs gleam">pub fn indentation_test() -&gt; a</code></pre> 267 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">indentation_test</span>() -> <span class="hljs-variable">a</span></code></pre> 268 268 269 269 <div class="rendered-markdown"><p>Here’s an example code snippet:</p> 270 270 <pre><code>wibble ··· 347 347 elem.classList.add("gleam"); 348 348 } 349 349 }); 350 + hljs.configure({ 351 + cssSelector: 'pre code:not(.hljs-ignore)' 352 + }) 350 353 hljs.highlightAll(); 351 354 </script> 352 355
+3
compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_module_comment_is_trimmed.snap
··· 317 317 elem.classList.add("gleam"); 318 318 } 319 319 }); 320 + hljs.configure({ 321 + cssSelector: 'pre code:not(.hljs-ignore)' 322 + }) 320 323 hljs.highlightAll(); 321 324 </script> 322 325
+3
compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_standalone_pages_is_not_trimmed.snap
··· 311 311 elem.classList.add("gleam"); 312 312 } 313 313 }); 314 + hljs.configure({ 315 + cssSelector: 'pre code:not(.hljs-ignore)' 316 + }) 314 317 hljs.highlightAll(); 315 318 </script> 316 319
+11 -2
compiler-core/src/docs/snapshots/gleam_core__docs__tests__no_hex_publish.snap
··· 304 304 elem.classList.add("gleam"); 305 305 } 306 306 }); 307 + hljs.configure({ 308 + cssSelector: 'pre code:not(.hljs-ignore)' 309 + }) 307 310 hljs.highlightAll(); 308 311 </script> 309 312 ··· 581 584 582 585 </div> 583 586 584 - <pre><code class="hljs gleam">pub fn one() -&gt; Int</code></pre> 587 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre> 585 588 586 589 <div class="rendered-markdown"><p>Here is some documentation</p> 587 590 </div> ··· 661 664 elem.classList.add("gleam"); 662 665 } 663 666 }); 667 + hljs.configure({ 668 + cssSelector: 'pre code:not(.hljs-ignore)' 669 + }) 664 670 hljs.highlightAll(); 665 671 </script> 666 672 ··· 938 944 939 945 </div> 940 946 941 - <pre><code class="hljs gleam">pub fn one() -&gt; Int</code></pre> 947 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre> 942 948 943 949 <div class="rendered-markdown"><p>Here is some documentation</p> 944 950 </div> ··· 1018 1024 elem.classList.add("gleam"); 1019 1025 } 1020 1026 }); 1027 + hljs.configure({ 1028 + cssSelector: 'pre code:not(.hljs-ignore)' 1029 + }) 1021 1030 hljs.highlightAll(); 1022 1031 </script> 1023 1032
+4 -1
compiler-core/src/docs/snapshots/gleam_core__docs__tests__tables.snap
··· 264 264 265 265 </div> 266 266 267 - <pre><code class="hljs gleam">pub fn one() -&gt; Int</code></pre> 267 + <pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre> 268 268 269 269 <div class="rendered-markdown"><table><thead><tr><th>heading 1</th><th>heading 2</th></tr></thead><tbody> 270 270 <tr><td>row 1 cell 1</td><td>row 1 cell 2</td></tr> ··· 347 347 elem.classList.add("gleam"); 348 348 } 349 349 }); 350 + hljs.configure({ 351 + cssSelector: 'pre code:not(.hljs-ignore)' 352 + }) 350 353 hljs.highlightAll(); 351 354 </script> 352 355
+3
compiler-core/templates/documentation_layout.html
··· 300 300 elem.classList.add("gleam"); 301 301 } 302 302 }); 303 + hljs.configure({ 304 + cssSelector: 'pre code:not(.hljs-ignore)' 305 + }) 303 306 hljs.highlightAll(); 304 307 </script> 305 308
+3 -3
compiler-core/templates/documentation_module.html
··· 55 55 {% endif %} 56 56 <div class="custom-type-constructors"> 57 57 <div class="rendered-markdown">{{ typ.documentation|safe }}</div> 58 - <pre><code class="hljs gleam">{{ typ.definition }}</code></pre> 58 + <pre><code class="hljs gleam hljs-ignore">{{ typ.definition|safe }}</code></pre> 59 59 {% if !typ.constructors.is_empty() %} 60 60 <h3> 61 61 Constructors ··· 65 65 <li class="constructor-item"> 66 66 <div class="constructor-row"> 67 67 <svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg> 68 - <pre class="constructor-name"><code class="hljs gleam">{{ constructor.definition }}</code></pre> 68 + <pre class="constructor-name"><code class="hljs gleam hljs-ignore">{{ constructor.definition|safe }}</code></pre> 69 69 </div> 70 70 71 71 <div class="constructor-item-docs"> ··· 119 119 {% endif %} 120 120 </div> 121 121 122 - <pre><code class="hljs gleam">{{ value.definition }}</code></pre> 122 + <pre><code class="hljs gleam hljs-ignore">{{ value.definition|safe }}</code></pre> 123 123 {% if !value.deprecation_message.is_empty() %} 124 124 <p> 125 125 <b>Deprecated:</b> {{ value.deprecation_message }}