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

[IGN] [Datahub] Add markdown support on metadata-info component #733

Closed
cdebarros opened this issue Dec 18, 2023 · 6 comments
Closed

[IGN] [Datahub] Add markdown support on metadata-info component #733

cdebarros opened this issue Dec 18, 2023 · 6 comments
Labels
enhancement Proposal for a new feature minor feature

Comments

@cdebarros
Copy link
Contributor

Hi, another feature i'd like to introduce.

We are going to use markdown as our metadata formatted text language (only the descriptive part).
So we need somehow to implement a markdown parser like marked to render markdown content as html.

Here is the kind of result i achieved to get.

Before:
Capture d’écran du 2023-12-18 17-48-09

Before:
Capture d’écran du 2023-12-18 17-48-36

It can be an optional setting in the toml file settings. And maybe extend it to others formatted text language ?

@jahow
Copy link
Collaborator

jahow commented Dec 18, 2023

I completely agree on using Markdown as the format for rich text fields (abstract, lineage etc.).

Currently the Datahub has a very simplistic approach, it will render the content of the abstract as HTML, so if there are HTML tags in it they will show up correctly. One thing that I was considering was to convert all HTML tags to Markdown at some point in the process, and have the metadata page simply render Markdown and not worry about the rest.

Other formatting languages can include RST but this is too elaborate, and I think Markdown is the right compromise as a common language.

@cdebarros
Copy link
Contributor Author

I did this feature, if i can contribute somehow.

I created a new ui-elements component to parse markdown content.
I used marked to parse the content and github-markdown-css to style elements.

Do i need some specific rights to push a new branch ? (or maybe should i fork the project ?)

@jahow
Copy link
Collaborator

jahow commented Dec 22, 2023

Please fork the project and open a Pull Request through Github, then a reviewer can examine your contribution and give you feedback. Thank you very much!

Also, please note that this change is not trivial since simply switching to MD instead of rendering HTML will break the appearance of many records that rely on HTML-based content (which the datahub currently handles).

@cdebarros
Copy link
Contributor Author

Thanks for your feedback, i will fork the project and open a pull request soon (today or in january after holidays).

From what i've tested, marked can take markdown and html content as input:

  • html content will render as it is, with no changes
  • markdown content is converted and rendered as html

The thing that can change, is the way we handle styling.
Shall we apply the default github markdown css to whatever input we get ?

@jahow
Copy link
Collaborator

jahow commented Dec 22, 2023

Thanks for the clarification, it sounds like marked will make everything quite simple! For styling I wouldn't bring in another library, instead we can probably define some basic styles for the following elements:

  • h1 to h6
  • ul, ol and li
  • p
  • a
  • blockquote
  • pre
  • code
  • hr
  • table

(basically everything that the basic syntax allows, see https://www.markdownguide.org/basic-syntax/)

That should be enough to have a basic layout showing up.

@cdebarros
Copy link
Contributor Author

I see, it makes more sense this way.
I will make this change and open a pull request when it's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Proposal for a new feature minor feature
Projects
None yet
Development

No branches or pull requests

3 participants