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

add basic API endpoint for rendering markdown #197

Merged
merged 5 commits into from Jan 3, 2020
Merged

Conversation

ghost
Copy link

@ghost ghost commented Oct 15, 2019

This adds a new POST endpoint /api/generate/markdownify which takes a JSON body:

{"raw_body": "raw markdown goes here"}

and a header Content-Type: application/json which will return a JSON response containing the html version.

{"body": "html lies here"}

  • I have signed the CLA

@ghost
Copy link
Author

ghost commented Oct 15, 2019

exact endpoint to be discussed

@thebaer thebaer added this to the 0.12 milestone Nov 11, 2019
postrender.go Outdated Show resolved Hide resolved
postrender.go Outdated Show resolved Hide resolved
postrender.go Outdated Show resolved Hide resolved
routes.go Outdated Show resolved Hide resolved
- return an error with invalid request types
- simplify json decoding
- return error and success consistent with app conventions
- endpoint change from /api/generate/markdownify to /api/markdown
- fix nil pointer dereference when passing a base_url
@ghost
Copy link
Author

ghost commented Dec 17, 2019

ready for re-review @thebaer

@thebaer
Copy link
Member

thebaer commented Dec 18, 2019

Great 👍

Last change: I think we should still return that out struct (with the body property) that you had before. That way, we get backward-compatibility if we ever want to return additional properties along with the rendered Markdown in the future.

Copy link
Member

@thebaer thebaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks, @robjloranger

@thebaer thebaer merged commit a457971 into develop Jan 3, 2020
@thebaer thebaer deleted the markdown-API branch January 3, 2020 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant