Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 66645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:08:09+00:00 2026-05-10T19:08:09+00:00

I am using the WMD markdown editor in a project for a large number

  • 0

I am using the WMD markdown editor in a project for a large number of fields that correspond to a large number of properties in a large number of Entity classes. Some classes may have multiple properties that require the markdown.

I am storing the markdown itself since this makes it easier to edit the fields later. However, I need to convert the properties to HTML for display later on. The question is: is there some pattern that I can use to avoid writing markdown conversion code in all my entity classes?

I created a utility class with a method that accepts a markdown string and returns the HTML. I am using markdownj and this works fine.

The problem is for each property of each class that stores markdown I may need another method that converts to HTML:

public class Course{       private String description;      .      .      .      public String getDescription(){           return description;      }       public String getDescriptionAsHTML(){           return MarkdownUtil.convert(getDescription());      }      .      .      .  } 

The problem there is that if the Course class has 2 more properties Tuition and Prerequisites say, that both need converters then I will have to write getTuitionAsHTML() and getPrerequisiteAsHTML().

I find that a bit ugly and would like a cleaner solution. The classes that require this are not part of a single inheritance hierarchy.

The other option I am considering is doing this in the controller rather than the model. What are your thoughts on this?

Thanks.

[EDIT]: New thoughts (Thanks Jasper). Since the project uses struts2 (I did not say this before) I could create a view component say that will convert the markdown for me. Then I use that wherever I need to display the value as HTML.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:08:10+00:00Added an answer on May 10, 2026 at 7:08 pm

    The classes that require this are not part of a single inheritance hierarchy.

    They should at least implement a common interface, otherwise coming up with a clean generic solution is going to be cumbersome.

    The other option I am considering is doing this in the controller rather than the model. What are your thoughts on this?

    This clearly is a responsibility of the View. The #1 MVC rule is that the Model doesn’t care about its representation, the markdown in this case.

    However, I feel that there is to little detail about your current architecture to give a meaningful answer to your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 61k
  • Answers 61k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Since you're talking of a NSView, you're probably using Cocoa's… May 11, 2026 at 9:38 am
  • added an answer As someone who recently switched a project from MySQL to… May 11, 2026 at 9:38 am
  • added an answer The xslt you are looking for to create an insert… May 11, 2026 at 9:38 am

Related Questions

I am using the WMD markdown editor in a project for a large number
I am using the Photoshop's javascript API to find the fonts in a given
I am using the code snippet below, however it's not working quite as I
I am using the AJAX Control Toolkit Popup Calendar Control in a datagrid. When
I am using the tablesorter plugin ( http://tablesorter.com ) and am having a problem
I am using the PHP 5 Tidy class to format html. Everything is fine
I am using the webbrowser control in winforms and discovered now that background images
I am using the example on the AJAX website for the DropDownExtender . I'm
I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on
I am using the jquery-ui-dialog plugin I am looking for way to refresh the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.