onegov-cloud icon indicating copy to clipboard operation
onegov-cloud copied to clipboard

Render fields as markdown

Open Tschuppi81 opened this issue 10 months ago • 5 comments

Directory: Render markdown in accordion layout

TYPE: Feature LINK: ogc-2131

Tschuppi81 avatar Mar 21 '25 12:03 Tschuppi81

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.26%. Comparing base (97478cf) to head (ac92189). Report is 14 commits behind head on master.

Additional details and impacted files
Files with missing lines Coverage Δ
src/onegov/org/layout.py 91.81% <100.00%> (+0.09%) :arrow_up:

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 97478cf...ac92189. Read the comment docs.

:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Mar 21 '25 12:03 codecov[bot]

@Tschuppi81 Did you check whether the other view type uses markdown? It might use to_html_ul, which should be sufficient for this use-case (it'll also add the correct css class for bulleted lists). Full markdown support seems like overkill to me.

Daverball avatar Mar 25 '25 08:03 Daverball

@Tschuppi81 Did you check whether the other view type uses markdown? It might use to_html_ul, which should be sufficient for this use-case (it'll also add the correct css class for bulleted lists). Full markdown support seems like overkill to me.

Actually nevermind, this is default form display rendering. So it is probably a markdown field. I would suggest relying on the field display renderer for rendering values, rather than trying to roll your own custom display. Have a look at the display_fields macro. You will need some special handling for UploadField/UploadMultipleField but for the rest you should be able to rely on form.render_display(field).

Although you may actually just be able to use the display_fields macro directly and rely purely on CSS for any style changes between the two layouts.

Daverball avatar Mar 25 '25 08:03 Daverball

Yes, I will try to reuse the display_fields macro

Tschuppi81 avatar Mar 26 '25 08:03 Tschuppi81