mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Make table cells at least 3 char long
This commit is contained in:
		
							parent
							
								
									90cff86ac0
								
							
						
					
					
						commit
						36179a8394
					
				@ -7,6 +7,7 @@ This is a fork of the original [turndown-plugin-gfm](https://github.com/domchris
 | 
			
		||||
- Always render tables even if they don't have a header.
 | 
			
		||||
- Don't render the border of tables that contain other tables (frequent for websites that do the layout using tables). Only render the inner tables, if any, and if they also don't contain other tables.
 | 
			
		||||
- Replace newlines (`\n`) with `<br>` inside table cells so that multi-line content is displayed correctly as Markdown.
 | 
			
		||||
- Table cells are at least three characters long (padded with spaces) so that they render correctly in GFM-compliant renderers.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -99,7 +99,9 @@ function cell (content, node) {
 | 
			
		||||
  var index = indexOf.call(node.parentNode.childNodes, node)
 | 
			
		||||
  var prefix = ' '
 | 
			
		||||
  if (index === 0) prefix = '| '
 | 
			
		||||
  return prefix + content.trim().replace(/[\n\r]/g, "<br>") + ' |'
 | 
			
		||||
  let filteredContent = content.trim().replace(/[\n\r]/g, "<br>");
 | 
			
		||||
  while (filteredContent.length < 3) filteredContent += ' ';
 | 
			
		||||
  return prefix + filteredContent + ' |'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function nodeContainsTable(node) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user