| | import java.util.List; |
| | |
| | -import static com.keenwrite.util.Strings.sanitize; |
| | - |
| | /** |
| | * Responsible for parsing and rendering Markdown into HTML. This is required |
| | * to break a circular dependency between the {@link MarkdownProcessor} and |
| | * {@link RInlineExtension}. |
| | */ |
| | public class BaseMarkdownProcessor extends ExecutorProcessor<String> { |
| | private final IParse mParser; |
| | private final IRender mRenderer; |
| | - private final String mTitle; |
| | |
| | public BaseMarkdownProcessor( |
| | final Processor<String> successor, final ProcessorContext context ) { |
| | super( successor ); |
| | |
| | - final var metadata = context.getMetadata(); |
| | final var options = new MutableDataSet(); |
| | options.set( HtmlRenderer.GENERATE_HEADER_ID, true ); |
 |
| | .extensions( extensions ) |
| | .build(); |
| | - mTitle = metadata.get( "title" ); |
| | } |
| | |
 |
| | private String toXhtml( final String html ) { |
| | final var document = DocumentConverter.parse( html ); |
| | - final var title = sanitize( mTitle ); |
| | - |
| | - // Ensure the document title is written when generating HTML. |
| | - if( !title.isBlank() ) { |
| | - document.title( title ); |
| | - } |
| | - |
| | - return document.html(); |
| | + return document.select( "body" ).html(); |
| | } |
| | |