{"id":13731968,"url":"https://github.com/enkisoftware/imgui_markdown","last_synced_at":"2025-05-14T20:07:37.498Z","repository":{"id":38435035,"uuid":"168187397","full_name":"enkisoftware/imgui_markdown","owner":"enkisoftware","description":"Markdown for Dear ImGui","archived":false,"fork":false,"pushed_at":"2025-03-26T18:31:15.000Z","size":71,"stargazers_count":1163,"open_issues_count":5,"forks_count":82,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-01T10:06:25.665Z","etag":null,"topics":["dear-imgui","game-development","gamedev","gui","imgui","library","markdown","ui"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enkisoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dougbinks","patreon":"enkisoftware","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.enkisoftware.com/avoyd"}},"created_at":"2019-01-29T16:26:34.000Z","updated_at":"2025-03-30T20:03:02.000Z","dependencies_parsed_at":"2024-07-30T21:06:29.059Z","dependency_job_id":null,"html_url":"https://github.com/enkisoftware/imgui_markdown","commit_stats":null,"previous_names":["enkisoftware/imgui_markdown"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enkisoftware%2Fimgui_markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enkisoftware%2Fimgui_markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enkisoftware%2Fimgui_markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enkisoftware%2Fimgui_markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enkisoftware","download_url":"https://codeload.github.com/enkisoftware/imgui_markdown/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829490,"owners_count":21002995,"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":["dear-imgui","game-development","gamedev","gui","imgui","library","markdown","ui"],"created_at":"2024-08-03T02:01:42.790Z","updated_at":"2025-04-08T11:06:53.941Z","avatar_url":"https://github.com/enkisoftware.png","language":"C++","readme":"Support development of imgui_markdown through [GitHub Sponsors](https://github.com/sponsors/dougbinks) or [Patreon](https://www.patreon.com/enkisoftware)\n\n[\u003cimg src=\"https://img.shields.io/static/v1?logo=github\u0026label=Github\u0026message=Sponsor\u0026color=#ea4aaa\" width=\"200\"/\u003e](https://github.com/sponsors/dougbinks)    [\u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" alt=\"Become a Patron\" width=\"150\"/\u003e](https://www.patreon.com/enkisoftware)\n\n# imgui_markdown\n\n## Markdown For Dear ImGui\n\nA permissively licensed markdown single-header library for [Dear ImGui](https://github.com/ocornut/imgui).\n\nRequires C++11 or above\n\nimgui_markdown currently supports the following markdown functionality:\n\n  * Wrapped text\n  * Headers H1, H2, H3\n  * Emphasis\n  * Indented text, multi levels\n  * Unordered list and sub-list\n  * Link\n  * Image\n  * Horizontal rule\n\n![imgui_markdown demo live editing](https://github.com/juliettef/Media/blob/main/imgui_markdown_demo_live_editing.gif?raw=true)\n\n*Note - the gif above is heavily compressed due to GitHub limitations. There's a [(slightly) better version of it on twitter](https://twitter.com/juulcat/status/1090996799266000898).*\n\n## Syntax\n\n### Wrapping\nText wraps automatically. To add a new line, use 'Return'.\n### Headers\n```\n# H1\n## H2\n### H3\n```\n### Emphasis\n```\n*emphasis*\n_emphasis_\n**strong emphasis**\n__strong emphasis__\n```\n### Lists\n#### Indent\nOn a new line, at the start of the line, add two spaces per indent.\n```\nNormal text\n··Indent level 1\n····Indent level 2\n······Indent level 3\nNormal text\n```\n#### Unordered list\nOn a new line, at the start of the line, add two spaces, an asterisks and a space. For nested lists, add two additional spaces in front of the asterisk per list level increment.\n```\nNormal text\n··*·Unordered List level 1\n····*·Unordered List level 2\n······*·Unordered List level 3\n······*·Unordered List level 3\n··*·Unordered List level 1\nNormal text\n```\n### Link\n```\n[link description](https://...)\n```\n### Image\n```\n![image alt text](image identifier e.g. filename)\n```\n### Horizontal Rule\n```\n***\n___\n```\n\n![Example use of imgui_markdown with icon fonts](https://github.com/juliettef/Media/blob/main/imgui_markdown_icon_font.jpg?raw=true)\n\n### Unsupported Syntax Combinations\nNon exhaustive\n  * Header with link, image or emphasis included - header breaks link, image, emphasis\n  * Emphasis with link or image - link, image break emphasis\n  * Multiline emphasis - new line breaks emphasis\n\n## Example Use On Windows With Links Opening In Browser\n\n```Cpp\n\n#include \"ImGui.h\"                // https://github.com/ocornut/imgui\n#include \"imgui_markdown.h\"       // https://github.com/juliettef/imgui_markdown\n#include \"IconsFontAwesome5.h\"    // https://github.com/juliettef/IconFontCppHeaders\n\n// Following includes for Windows LinkCallback\n#define WIN32_LEAN_AND_MEAN\n#include \u003cWindows.h\u003e\n#include \"Shellapi.h\"\n#include \u003cstring\u003e\n\nvoid LinkCallback( ImGui::MarkdownLinkCallbackData data_ );\ninline ImGui::MarkdownImageData ImageCallback( ImGui::MarkdownLinkCallbackData data_ );\n\nstatic ImFont* H1 = NULL;\nstatic ImFont* H2 = NULL;\nstatic ImFont* H3 = NULL;\n\nstatic ImGui::MarkdownConfig mdConfig; \n\n\nvoid LinkCallback( ImGui::MarkdownLinkCallbackData data_ )\n{\n    std::string url( data_.link, data_.linkLength );\n    if( !data_.isImage )\n    {\n        ShellExecuteA( NULL, \"open\", url.c_str(), NULL, NULL, SW_SHOWNORMAL );\n    }\n}\n\ninline ImGui::MarkdownImageData ImageCallback( ImGui::MarkdownLinkCallbackData data_ )\n{\n    // In your application you would load an image based on data_ input. Here we just use the imgui font texture.\n    ImTextureID image = ImGui::GetIO().Fonts-\u003eTexID;\n    // \u003e C++14 can use ImGui::MarkdownImageData imageData{ true, false, image, ImVec2( 40.0f, 20.0f ) };\n    ImGui::MarkdownImageData imageData;\n    imageData.isValid =         true;\n    imageData.useLinkCallback = false;\n    imageData.user_texture_id = image;\n    imageData.size =            ImVec2( 40.0f, 20.0f );\n\n    // For image resize when available size.x \u003e image width, add\n    ImVec2 const contentSize = ImGui::GetContentRegionAvail();\n    if( imageData.size.x \u003e contentSize.x )\n    {\n        float const ratio = imageData.size.y/imageData.size.x;\n        imageData.size.x = contentSize.x;\n        imageData.size.y = contentSize.x*ratio;\n    }\n\n    return imageData;\n}\n\nvoid LoadFonts( float fontSize_ = 12.0f )\n{\n    ImGuiIO\u0026 io = ImGui::GetIO();\n    io.Fonts-\u003eClear();\n    // Base font\n    io.Fonts-\u003eAddFontFromFileTTF( \"myfont.ttf\", fontSize_ );\n    // Bold headings H2 and H3\n    H2 = io.Fonts-\u003eAddFontFromFileTTF( \"myfont-bold.ttf\", fontSize_ );\n    H3 = mdConfig.headingFormats[ 1 ].font;\n    // bold heading H1\n    float fontSizeH1 = fontSize_ * 1.1f;\n    H1 = io.Fonts-\u003eAddFontFromFileTTF( \"myfont-bold.ttf\", fontSizeH1 );\n}\n\nvoid ExampleMarkdownFormatCallback( const ImGui::MarkdownFormatInfo\u0026 markdownFormatInfo_, bool start_ )\n{\n    // Call the default first so any settings can be overwritten by our implementation.\n    // Alternatively could be called or not called in a switch statement on a case by case basis.\n    // See defaultMarkdownFormatCallback definition for furhter examples of how to use it.\n    ImGui::defaultMarkdownFormatCallback( markdownFormatInfo_, start_ );        \n       \n    switch( markdownFormatInfo_.type )\n    {\n    // example: change the colour of heading level 2\n    case ImGui::MarkdownFormatType::HEADING:\n    {\n        if( markdownFormatInfo_.level == 2 )\n        {\n            if( start_ )\n            {\n                ImGui::PushStyleColor( ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled] );\n            }\n            else\n            {\n                ImGui::PopStyleColor();\n            }\n        }\n        break;\n    }\n    default:\n    {\n        break;\n    }\n    }\n}\n\nvoid Markdown( const std::string\u0026 markdown_ )\n{\n    // You can make your own Markdown function with your prefered string container and markdown config.\n    // \u003e C++14 can use ImGui::MarkdownConfig mdConfig{ LinkCallback, NULL, ImageCallback, ICON_FA_LINK, { { H1, true }, { H2, true }, { H3, false } }, NULL };\n    mdConfig.linkCallback =         LinkCallback;\n    mdConfig.tooltipCallback =      NULL;\n    mdConfig.imageCallback =        ImageCallback;\n    mdConfig.linkIcon =             ICON_FA_LINK;\n    mdConfig.headingFormats[0] =    { H1, true };\n    mdConfig.headingFormats[1] =    { H2, true };\n    mdConfig.headingFormats[2] =    { H3, false };\n    mdConfig.userData =             NULL;\n    mdConfig.formatCallback =       ExampleMarkdownFormatCallback;\n    ImGui::Markdown( markdown_.c_str(), markdown_.length(), mdConfig );\n}\n\nvoid MarkdownExample()\n{\n    const std::string markdownText = u8R\"(\n# H1 Header: Text and Links\nYou can add [links like this one to enkisoftware](https://www.enkisoftware.com/) and lines will wrap well.\nYou can also insert images ![image alt text](image identifier e.g. filename)\nHorizontal rules:\n***\n___\n*Emphasis* and **strong emphasis** change the appearance of the text.\n## H2 Header: indented text.\n  This text has an indent (two leading spaces).\n    This one has two.\n### H3 Header: Lists\n  * Unordered lists\n    * Lists can be indented with two extra spaces.\n  * Lists can have [links like this one to Avoyd](https://www.avoyd.com/) and *emphasized text*\n)\";\n    Markdown( markdownText );\n}\n```\n\n## Projects Using imgui_markdown\n\n### [Avoyd](https://www.enkisoftware.com/avoyd)\nAvoyd is an abstract 6 degrees of freedom voxel game.  \n[www.avoyd.com](https://www.avoyd.com)  \n\nThe game and the voxel editor's help and tutorials use imgui_markdown with Dear ImGui.  \n\n![Avoyd screenshot](https://github.com/juliettef/Media/blob/main/imgui_markdown_Avoyd_about_OSS.png?raw=true)\n\n### [bgfx](https://github.com/bkaradzic/bgfx)\nCross-platform rendering library.  \n[bkaradzic.github.io/bgfx/overview](https://bkaradzic.github.io/bgfx/overview.html)\n\n### [Imogen](https://github.com/CedricGuillemet/Imogen)\nGPU/CPU Texture Generator  \n[skaven.fr/imogen](http://skaven.fr/imogen/)\n\n![Imogen screenshot](https://camo.githubusercontent.com/28347bc0c1627aa4f289e1b2b769afcb3a5de370/68747470733a2f2f692e696d6775722e636f6d2f7351664f3542722e706e67)\n\n### [Light Tracer](https://lighttracer.org/)\nExperimental GPU ray tracer for web\n\n![Light Tracer screenshot](https://github.com/juliettef/Media/blob/main/imgui_markdown_Light_Tracer.png?raw=true)\n\n### [Visual 6502 Remix](https://github.com/floooh/v6502r)\nTransistor level 6502 Hardware Simulation  \n[hfloooh.github.io/visual6502remix](https://floooh.github.io/visual6502remix/)  \n\nUsing imgui_markdown as help viewer for Visual 6502 Remix with internal and external links: \n \n[![Using imgui_markdown as help viewer for Visual 6502 Remix with internal and external links - animated gif](https://user-images.githubusercontent.com/1699414/69185510-320baa00-0b17-11ea-9fd5-82ed6e02a05c.gif)\n![Using imgui_markdown as help viewer for Visual 6502 Remix - screenshot](https://user-images.githubusercontent.com/1699414/69185626-67b09300-0b17-11ea-85a8-fed54a0082b4.png)](https://github.com/ocornut/imgui/issues/2847#issuecomment-555710973)  \n\n![Using imgui_markdown in the About page for Visual 6502 Remix - screenshot](https://github.com/juliettef/Media/blob/main/imgui_markdown_Visual_6502_Remix_About.png?raw=true)\n\n## Credits\n\nDesign and implementation - [Doug Binks](http://www.enkisoftware.com/about.html#doug) - [@dougbinks](https://github.com/dougbinks)  \nImplementation and maintenance - [Juliette Foucaut](http://www.enkisoftware.com/about.html#juliette) - [@juliettef](https://github.com/juliettef)  \n[Image resize](https://github.com/juliettef/imgui_markdown/pull/15) example code - [Soufiane Khiat](https://github.com/soufianekhiat)  \nEmphasis and horizontal rule initial implementation - [Dmitry Mekhontsev](https://github.com/mekhontsev)  \nThanks to [Omar Cornut for Dear ImGui](https://github.com/ocornut/imgui)  \n\n## License (zlib)\n\nCopyright (c) 2019 Juliette Foucaut and Doug Binks\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n   claim that you wrote the original software. If you use this software\n   in a product, an acknowledgment in the product documentation would be\n   appreciated but is not required.\n2. Altered source versions must be plainly marked as such, and must not be\n   misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n","funding_links":["https://github.com/sponsors/dougbinks","https://patreon.com/enkisoftware","https://www.enkisoftware.com/avoyd","https://www.patreon.com/enkisoftware"],"categories":["Graphics","Uncategorized","C++"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenkisoftware%2Fimgui_markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenkisoftware%2Fimgui_markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenkisoftware%2Fimgui_markdown/lists"}