New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing to compile MarkDown posts from string to string. #2622
Conversation
…tring function support.
@@ -63,6 +63,15 @@ def set_site(self, site): | |||
|
|||
self.config_dependencies.append(str(sorted(site.config.get("MARKDOWN_EXTENSIONS")))) | |||
|
|||
def compile_to_string(self, content): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But please match the reST plugin API.
def compile_string(self, data, source_path=None, is_two_file=True):
"""Compile Markdown into HTML strings."""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
if markdown is None: | ||
req_missing(['markdown'], 'build this site (compile Markdown)') | ||
self.extensions += self.site.config.get("MARKDOWN_EXTENSIONS") | ||
if not is_two_file: | ||
_, content = self.split_metadata(content) | ||
output = markdown(content, self.extensions, output_format="html5") | ||
output, shortcode_deps = self.site.apply_shortcodes(output, filename=source, with_dependencies=True, extra_context=dict(post=post)) | ||
output, shortcode_deps = self.site.apply_shortcodes(output, filename=source_path, with_dependencies=True, extra_context={'post': post}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing that!
Thanks! |
Allows to compile MarkDown from string to string (for getnikola/plugins#201).