Skip to content

Commit

Permalink
[#3128] Render resource view descriptions as Markdown.
Browse files Browse the repository at this point in the history
Previously, CKAN rendered resource view descriptions as plain text, in
contrast to the help text given in the resource view edit form which
says that Markdown is supported.
  • Loading branch information
torfsen committed Jun 21, 2016
1 parent a4ae04a commit 1fe29c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/templates/package/snippets/resource_view.html
Expand Up @@ -10,7 +10,7 @@
<i class="icon-code"></i>
{{ _("Embed") }}
</a>
<p class="desc">{{ resource_view['description'] }}</p>
<p class="desc">{{ h.render_markdown(resource_view['description']) }}</p>
<div class="m-top ckanext-datapreview">
{% if not to_preview and h.resource_view_is_filterable(resource_view) %}
{% snippet 'package/snippets/resource_view_filters.html', resource=resource %}
Expand Down
11 changes: 11 additions & 0 deletions ckan/tests/controllers/test_package.py
Expand Up @@ -1050,6 +1050,17 @@ def test_inexistent_resource_view_page_returns_not_found_code(self):
app = self._get_test_app()
app.get(url, status=404)

def test_resource_view_description_is_rendered_as_markdown(self):
resource_view = factories.ResourceView(description="Some **Markdown**")
url = url_for(controller='package',
action='resource_read',
id=resource_view['package_id'],
resource_id=resource_view['resource_id'],
view_id=resource_view['id'])
app = self._get_test_app()
response = app.get(url)
response.mustcontain('Some <strong>Markdown</strong>')


class TestResourceRead(helpers.FunctionalTestBase):
@classmethod
Expand Down

0 comments on commit 1fe29c7

Please sign in to comment.