mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fix(export/markdown): fix code in tables
This commit is contained in:
		| @@ -221,6 +221,7 @@ const tableShouldBeHtml = (tableNode, options) => { | |||||||
|     'H6', |     'H6', | ||||||
|     'HR', |     'HR', | ||||||
|     'BLOCKQUOTE', |     'BLOCKQUOTE', | ||||||
|  |     'PRE' | ||||||
|   ]; |   ]; | ||||||
|  |  | ||||||
|   // In general we should leave as HTML tables that include other tables. The |   // In general we should leave as HTML tables that include other tables. The | ||||||
|   | |||||||
| @@ -193,4 +193,37 @@ describe("Markdown export", () => { | |||||||
|         expect(markdownExportService.toMarkdown(html)).toBe(expected); |         expect(markdownExportService.toMarkdown(html)).toBe(expected); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     it("exports code in tables properly", () => { | ||||||
|  |         const html = trimIndentation`\ | ||||||
|  |         <table> | ||||||
|  |             <tr> | ||||||
|  |                 <td> | ||||||
|  |                     Row 1 | ||||||
|  |                 </td> | ||||||
|  |                 <td> | ||||||
|  |                     <p>Allows displaying the value of one or more attributes in the calendar | ||||||
|  |                         like this: </p> | ||||||
|  |                     <p> | ||||||
|  |                         <img src="13_Calendar View_image.png" alt=""> | ||||||
|  |                     </p> | ||||||
|  |  | ||||||
|  |                     <pre><code class="language-text-x-trilium-auto">#weight="70" | ||||||
|  |                     #Mood="Good" | ||||||
|  |                     #calendar:displayedAttributes="weight,Mood"</code></pre> | ||||||
|  |                     <p>It can also be used with relations, case in which it will display the | ||||||
|  |                         title of the target note:</p><pre><code class="language-text-x-trilium-auto">~assignee=@My assignee | ||||||
|  |                     #calendar:displayedAttributes="assignee"</code></pre> | ||||||
|  |                 </td> | ||||||
|  |             </tr> | ||||||
|  |         </table> | ||||||
|  |         `; | ||||||
|  |  | ||||||
|  |         const expected = trimIndentation`\ | ||||||
|  |             <div class="joplin-table-wrapper"><table><tbody><tr><td>Row 1</td><td><p>Allows displaying the value of one or more attributes in the calendar like this: </p><p><img src="13_Calendar View_image.png" alt=""></p><pre><code class="language-text-x-trilium-auto">#weight="70" | ||||||
|  |                         #Mood="Good" | ||||||
|  |                         #calendar:displayedAttributes="weight,Mood"</code></pre><p>It can also be used with relations, case in which it will display the title of the target note:</p><pre><code class="language-text-x-trilium-auto">~assignee=@My assignee | ||||||
|  |                         #calendar:displayedAttributes="assignee"</code></pre></td></tr></tbody></table></div>`; | ||||||
|  |         expect(markdownExportService.toMarkdown(html)).toBe(expected); | ||||||
|  |     }); | ||||||
|  |  | ||||||
| }); | }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user