Created
April 29, 2015 00:50
-
-
Save orb/e1ebb44d0af696e201ca to your computer and use it in GitHub Desktop.
trivial Markdown4j example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package zoo; | |
| import java.io.IOException; | |
| import javax.servlet.ServletException; | |
| import javax.servlet.annotation.WebServlet; | |
| import javax.servlet.http.HttpServlet; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; | |
| import org.markdown4j.Markdown4jProcessor; | |
| @WebServlet("/split") | |
| public class Split extends HttpServlet { | |
| @Override | |
| protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | |
| String markdown = "# This is a special\n" + | |
| "- Burgers $5\n" + | |
| "- Drinks $1\n" + | |
| "- ~~hello~~"; | |
| Markdown4jProcessor processor = new Markdown4jProcessor(); | |
| req.setAttribute("special", processor.process(markdown)); | |
| req.getRequestDispatcher("/WEB-INF/split.jsp").forward(req, resp); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment