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

Use markdown in rdfs:comments and other fields #64

Open
jo-tud opened this issue Oct 27, 2017 · 2 comments · May be fixed by #133
Open

Use markdown in rdfs:comments and other fields #64

jo-tud opened this issue Oct 27, 2017 · 2 comments · May be fixed by #133

Comments

@jo-tud
Copy link

jo-tud commented Oct 27, 2017

I use markdown in rdfs:comments and other fields and I would like to display that markdown rendered as text on the pages. How could that be done?

@VladimirAlexiev
Copy link

@lambdamusic lambdamusic transferred this issue from lambdamusic/Ontodocs Dec 18, 2018
@rvesse
Copy link

rvesse commented Sep 27, 2023

Think the underlying problem here is that the Markdown templates use the Django linebreaks filter here which per its documentation:

Replaces line breaks in plain text with appropriate HTML; a single newline becomes an HTML line break (<br>) and a new line followed by a blank line becomes a paragraph break (</p>)

Which is entirely unnecessary since Markdown will handle line breaks naturally anyway.

The by-product of this is that Markdown in the rdfs:comment's doesn't then get rendered because most Markdown renderers don't render Markdown inside HTML block elements like <p>, if you manually strip out the <p> tags from the resulting Markdown files then the actual Markdown from your ontology comments does get rendered.

So think the Markdown templates just want updating to not use the linebreaks filter

rvesse added a commit to rvesse/Ontospy that referenced this issue Sep 27, 2023
The Markdown Django templates were using the linebreaks filter on some
of the content.  This filter wraps content using <p> and <br />.
However this means that if the ontology was using Markdown in their
comments this would not get rendered as most Markdown renderers don't
apply rendering inside of HTML block elements like <p>.  It was also
unnecessary since Markdown renderers already use line breaks to suitably
render paragraphs.

This was most applicable for descriptions of things since those are the
places were ontology authors were most likely to want to use Markdown to
explain the intended usage of their ontology concepts.

By removing the use of this filter the ontology descriptions are output
as-is in the generated Markdown files allowing any Markdown in them to
be rendered by whatever Markdown renderer the user ultimately chooses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants