Skip to content

Commit

Permalink
Merge pull request #6 from IUBLibTech/markdown-helper
Browse files Browse the repository at this point in the history
IULRDC-10 Add markdown helper for catalog fields
  • Loading branch information
dlpierce authored Sep 20, 2024
2 parents c9c5800 + 69db6f4 commit 299f021
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def self.modified_field
# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
config.add_index_field "title_tesim", label: "Title", itemprop: 'name', if: false
config.add_index_field "summary_tesim", label: "Summary", itemprop: 'summary', helper_method: :iconify_auto_link
config.add_index_field "summary_tesim", label: "Summary", itemprop: 'summary', helper_method: :render_markdown
config.add_index_field "keyword_tesim", itemprop: 'keywords', link_to_facet: "keyword_sim"
# config.add_index_field "subject_tesim", itemprop: 'about', link_to_facet: "subject_sim"
config.add_index_field "creator_tesim", itemprop: 'creator', link_to_facet: "creator_sim"
Expand Down
6 changes: 6 additions & 0 deletions app/helpers/hyrax_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ module HyraxHelper
include ::BlacklightHelper
include Hyrax::BlacklightOverride
include Hyrax::HyraxHelperBehavior

# For use as helper method in catalog controller field definitions.
def render_markdown(field)
text = field[:value].join("\n\n")
DataCatalog::MarkdownService.call(text).html_safe
end
end

0 comments on commit 299f021

Please sign in to comment.