mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:52:46 +00:00 
			
		
		
		
	 30437b0936
			
		
	
	
		30437b0936
		
	
	
	
	
		
			
			We can now parse links that like this: visit the [SerenityOS home page](http://www.serenityos.org/) producing proper <a> HTML elements ^)
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			504 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			504 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/String.h>
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| class MDText final {
 | |
| public:
 | |
|     struct Style {
 | |
|         bool emph { false };
 | |
|         bool strong { false };
 | |
|         bool code { false };
 | |
|         String href;
 | |
|     };
 | |
| 
 | |
|     struct Span {
 | |
|         String text;
 | |
|         Style style;
 | |
|     };
 | |
| 
 | |
|     const Vector<Span>& spans() const { return m_spans; }
 | |
| 
 | |
|     String render_to_html() const;
 | |
|     String render_for_terminal() const;
 | |
| 
 | |
|     bool parse(const StringView&);
 | |
| 
 | |
| private:
 | |
|     Vector<Span> m_spans;
 | |
| };
 |