{"id":19428469,"url":"https://github.com/gitbucket/markedj","last_synced_at":"2025-04-04T16:13:11.355Z","repository":{"id":47568650,"uuid":"42617444","full_name":"gitbucket/markedj","owner":"gitbucket","description":"JVM port of graceful markdown processor marked.js","archived":false,"fork":false,"pushed_at":"2025-03-22T22:35:04.000Z","size":188,"stargazers_count":87,"open_issues_count":2,"forks_count":23,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-28T15:09:15.432Z","etag":null,"topics":["java","markdown"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitbucket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-16T22:49:23.000Z","updated_at":"2025-03-22T22:35:07.000Z","dependencies_parsed_at":"2023-01-30T23:45:58.890Z","dependency_job_id":"26777102-207d-4b49-8649-cdfa362cb404","html_url":"https://github.com/gitbucket/markedj","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitbucket%2Fmarkedj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitbucket%2Fmarkedj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitbucket%2Fmarkedj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitbucket%2Fmarkedj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitbucket","download_url":"https://codeload.github.com/gitbucket/markedj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208139,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","markdown"],"created_at":"2024-11-10T14:15:20.966Z","updated_at":"2025-04-04T16:13:11.339Z","avatar_url":"https://github.com/gitbucket.png","language":"Java","readme":"# markedj [![build](https://github.com/gitbucket/markedj/workflows/build/badge.svg?branch=master)](https://github.com/gitbucket/markedj/actions?query=branch%3Amaster+workflow%3Abuild) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.gitbucket/markedj/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.gitbucket/markedj) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/gitbucket/markedj/blob/master/LICENSE)\n\nJVM port of graceful markdown processor [marked.js](https://github.com/chjj/marked).\n\n## Usage\n\nFirst, add following dependency into your `pom.xml`:\n\n```xml\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eio.github.gitbucket\u003c/groupId\u003e\n    \u003cartifactId\u003emarkedj\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.20\u003c/version\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nYou can easily use markedj via `io.github.gitbucket.markedj.Marked`:\n\n```java\nimport io.github.gitbucket.markedj.*;\n\nString markdown = ...\n\n// With default options\nString html1 = Marked.marked(markdown);\n\n// Specify options\nOptions options = new Options();\noptions.setSanitize(true);\n\nString html2 = Marked.marked(markdown, options);\n```\n\n## Options\n\n`io.github.gitbucket.markedj.Options` has following properties to control Markdown conversion:\n\nName         | Default | Description\n:------------|:--------|:------------\ngfm          | true    | Enable [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown).\ntables       | true    | Enable GFM [tables](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables). This option requires the `gfm` option to be true.\nbreaks       | false   | Enable GFM [line breaks](https://help.github.com/articles/github-flavored-markdown#newlines). This option requires the `gfm` option to be true.\nsanitize     | false   | Ignore any HTML that has been input.\nlangPrefix   | \"lang-\" | Prefix of class attribute of code block\nheaderPrefix | \"\"      | Prefix of id attribute of header\nsafelist     | See [Options.java](https://github.com/gitbucket/markedj/blob/master/src/main/java/io/github/gitbucket/markedj/Options.java) | Safelist of HTML tags.\nextensions   | empty   | Extensions. See [Extensions](#extensions) section\n\nBy default, markedj uses Jsoup's safelist mechanism for HTML rendering. It restricts renderable tags, attributes and even protocols of attribute values. For example, the image url must be `http://` or `https://` by default. You can remove this restriction by customizing the safelist as follows:\n\n```java\nString html1 = Marked.marked(\"![alt text](/img/some-image.png \\\"title\\\")\");\n  // =\u003e \u003cp\u003e\u003cimg alt=\\\"alt text\\\" title=\\\"title\\\"\u003e\u003c/p\u003e\n\nOptions options = new Options();\noptions.getSafelist().removeProtocols(\"img\", \"src\", \"http\", \"https\");\n\nString html2 = Marked.marked(\"![alt text](/img/some-image.png \\\"title\\\")\", options);\n  // =\u003e \u003cp\u003e\u003cimg src=\"/img/some-image.png\" alt=\"alt text\" title=\"title\"\u003e\u003c/p\u003e\n```\n\n## Extensions\n\nMarkedj can be extended by implementing [custom extensions](https://github.com/gitbucket/markedj/blob/master/src/main/java/io/github/gitbucket/markedj/extension/Extension.java).\nExtensions can be used by adding them to the options.\n\n```java\nOptions options = new Options();\noptions.addExtension(new GFMAlertExtension());\nString html = Marked.marked(\"\u003e [!NOTE]\\n\u003e This is a note!\", options);\n```\n\n### GFMAlert extension\n\nSupport for github like [alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts).\n\nFor styling, some project-specific CSS is required.\n\n```java\nOptions options = new Options();\n// Override default title for note alert\nGFMAlertOptions alertOptions = new GFMAlertOptions();\nalertOptions.setTitle(GFMAlerts.Alert.WARNING, \"Attention!!!\");\nGFMAlertExtension gfmAlerts = new GFMAlertExtension(alertOptions);\noptions.addExtension(gfmAlerts);\nString html = Marked.marked(\"\u003e [!NOTE]\\n\u003e This is a note!\", options);\n```\n\nSupported alert types are `NOTE`, `TOP`, `IMPORTANT`, `WARNING`, and `CAUTION`. Here is a Markdown example:\n\n```markdown\n\u003e [!NOTE]\n\u003e Useful information that users should know, even when skimming content.\n```\n\nThis is translated to the following HTML:\n\n```html\n\u003cdiv class=\"markdown-alert markdown-alert-note\"\u003e\n  \u003cp class=\"markdown-alert-title\"\u003eNote\u003c/p\u003e\n  \u003cp\u003eUseful information that users should know, even when skimming content.\u003c/p\u003e\n\u003c/div\u003e\n```\n\nGenerated HTML can be customized by implementing your own renderer. [DefaultGFMAlertRenderer](https://github.com/gitbucket/markedj/blob/master/src/main/java/io/github/gitbucket/markedj/extension/gfm/alert/DefaultGFMAlertRenderer.java) is used by default.\n\n## for Developers\n\n### Release\n\nRun the following command to upload artifacts to sonatype:\n\n```\nmvn clean deploy -DperformRelease=true\n```\n\nThen, go to https://oss.sonatype.org/, close and release the staging repository. \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitbucket%2Fmarkedj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitbucket%2Fmarkedj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitbucket%2Fmarkedj/lists"}