This is a full-featured markdown parser and renderer for ABAP.
- 100% ABAP
- Fully tested with automated ABAP unit test cases
- Parses GitHub flavored Markdown
Compared to the original ABAP Markdown, the following has been added:
- Option to render href and img src links with a different root
- Option to use sapevent for launching links in an external browser
- Option to set root path for internal links
- Normalizing of link paths
- Support for sapevent as a protocol
- Syntax highlighting (based on abapGit + diff + markdown)
- Support for internal links (
# Heading {#custom-id}
) - Support for strikethrough, subscript, superscript, and highlight
- Support for task list (
[ ] or [x] task
) - Support for GitHub alerts
- Fix for escaped
|
in tables - Required CSS available as code
- Removed variable prefixes (strict abaplint rules)
NO WARRANTIES, MIT License
Render markdown as HTML:
DATA(markdown_as_html) = NEW /apmg/cl_markdown( )->text( raw_markdown ).
Get the CSS required to render the HTML correctly:
DATA(styles) = /apmg/cl_markdown=>styles( ).
You can set options to render HREF and IMG src links with a different root, to set a root path for internal links, or use sapevent for launching links in an external browser:
DATA(markdown_service) = NEW /apmg/cl_markdown(
root_href = root_href
root_img = root_img
path = path
sapevent = abap_true ).
Option | Description | Example |
---|---|---|
root_href |
Absolute URL + path to prefix any HREF links | https://github.com/abapGit/abapGit/blob/main |
root_img |
Absolute URL + path to prefix any IMG src links | https://github.com/abapGit/abapGit/raw/main |
path |
Relative path to markdown file (if it's not in / ) |
src/docs |
sapevent |
Flag to change href links to sapevent protocol |
abap_true |
You can change render modes with the following methods:
Method | Default | Description |
---|---|---|
set_safe_mode |
abap_false |
Process untrusted user-input (see Parsedown) |
set_markup_escaped |
abap_false |
Escape HTML in trusted input (see Parsedown) |
set_breaks_enabled |
abap_false |
Allow empty lines in markdown (rendered as <br /> ) |
set_urls_linked |
abap_true |
Change inline URLs to HREF links |
DATA(html) = NEW /apmg/cl_markdown( )->text( 'Hello, _World_!' ).
WRITE / html.
Output:
<p>Hello, <em>World</em>!</p>
SAP Basis 7.50 or higher
Install markdown
as a global module in your system using apm.
or
Specify the markdown
module as a dependency in your project and import it to your namespace using apm.
All contributions are welcome! Read our Contribution Guidelines, fork this repo, and create a pull request.
You can install the developer version of ABAP MARKDOWN using abapGit either by creating a new online repository for https://github.com/abapPM/ABAP-Markdown
.
Recommended SAP package: /APMG/MARKDOWN
This project includes the code from the following open-source projects. Please support them if you can!
- ABAP Markdown, Guilherme Maeda, MIT
- Parsedown, Emanuil Rusev, MIT
Made with ❤ in Canada
Copyright 2025 apm.to Inc. https://apm.to