forked from MapComplete/MapComplete
		
	Add better support for markdown (switch nano-markdown for markdown-it as the former doesn't support backtick-code-formatting), add Markdown element. See #1929
This commit is contained in:
		
							parent
							
								
									9ead113555
								
							
						
					
					
						commit
						d2e7bac775
					
				
					 10 changed files with 120 additions and 32 deletions
				
			
		
							
								
								
									
										17
									
								
								src/UI/Base/Markdown.svelte
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/UI/Base/Markdown.svelte
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| <script lang="ts"> | ||||
|   import markdownit from "markdown-it" | ||||
|   import { UIEventSource } from "../../Logic/UIEventSource" | ||||
|   const md = markdownit() | ||||
|   export let src: string | ||||
|   export let srcWritable: UIEventSource<string> = undefined | ||||
|   srcWritable?.addCallbackAndRunD(t => { | ||||
|     src = t | ||||
|   }) | ||||
|   if(typeof src !== "string") { | ||||
|     throw "Markdown.svelte got a non-string object" | ||||
|   } | ||||
| </script> | ||||
| {#if src?.length > 0} | ||||
|   {@html md.render(src)} | ||||
| {/if} | ||||
| 
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue