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
merged 4 commits into from Jan 8, 2017

Conversation

@felixfontein
Copy link
Contributor

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 pull request Jan 8, 2017
…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):

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Jan 8, 2017

Member

But please match the reST plugin API.

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

This comment has been minimized.

Copy link
@felixfontein

felixfontein Jan 8, 2017

Author Contributor

Done.

felixfontein and others added 3 commits Jan 8, 2017
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})

This comment has been minimized.

Copy link
@felixfontein

felixfontein Jan 8, 2017

Author Contributor

Thanks for fixing that!

@Kwpolska Kwpolska merged commit 80abb4a into master Jan 8, 2017
0 of 5 checks passed
0 of 5 checks passed
codacy/pr Hang in there, Codacy is reviewing your Pull request.
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
@Kwpolska Kwpolska deleted the markdown-to-string branch Jan 8, 2017
@felixfontein
Copy link
Contributor Author

felixfontein commented Jan 8, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.