Skip to content
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

merged 4 commits into from Jan 8, 2017


Copy link

@felixfontein felixfontein commented Jan 8, 2017

Allows to compile MarkDown from string to string (for getnikola/plugins#201).

felixfontein added a commit to getnikola/plugins that referenced this issue Jan 8, 2017
@@ -63,6 +63,15 @@ def set_site(self, site):


def compile_to_string(self, content):
Copy link

@Kwpolska Kwpolska Jan 8, 2017

But please match the reST plugin API.

    def compile_string(self, data, source_path=None, is_two_file=True):
        """Compile Markdown into HTML strings."""

Copy link
Contributor Author

@felixfontein felixfontein Jan 8, 2017


if markdown is None:
req_missing(['markdown'], 'build this site (compile Markdown)')
self.extensions +="MARKDOWN_EXTENSIONS")
if not is_two_file:
_, content = self.split_metadata(content)
output = markdown(content, self.extensions, output_format="html5")
output, shortcode_deps =, filename=source, with_dependencies=True, extra_context=dict(post=post))
output, shortcode_deps =, filename=source_path, with_dependencies=True, extra_context={'post': post})
Copy link
Contributor Author

@felixfontein felixfontein Jan 8, 2017

Thanks for fixing that!

@Kwpolska Kwpolska merged commit 80abb4a into master Jan 8, 2017
0 of 5 checks passed
@Kwpolska Kwpolska deleted the markdown-to-string branch Jan 8, 2017
Copy link
Contributor Author

@felixfontein felixfontein commented Jan 8, 2017


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants