mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	 0a21c2bace
			
		
	
	
		0a21c2bace
		
	
	
	
	
		
			
			From the commonmark spec: A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.)
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			681 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			681 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <AK/StringBuilder.h>
 | |
| #include <LibMarkdown/Paragraph.h>
 | |
| 
 | |
| namespace Markdown {
 | |
| 
 | |
| String Paragraph::render_to_html(bool tight) const
 | |
| {
 | |
|     StringBuilder builder;
 | |
| 
 | |
|     if (!tight)
 | |
|         builder.append("<p>");
 | |
| 
 | |
|     builder.append(m_text.render_to_html());
 | |
| 
 | |
|     if (!tight)
 | |
|         builder.append("</p>");
 | |
| 
 | |
|     builder.append('\n');
 | |
| 
 | |
|     return builder.build();
 | |
| }
 | |
| 
 | |
| String Paragraph::render_for_terminal(size_t) const
 | |
| {
 | |
|     StringBuilder builder;
 | |
|     builder.append(m_text.render_for_terminal());
 | |
|     builder.append("\n\n");
 | |
|     return builder.build();
 | |
| }
 | |
| 
 | |
| }
 |