{"id":27864641,"url":"https://github.com/commonsguy/cwac-anddown","last_synced_at":"2025-05-04T21:09:11.307Z","repository":{"id":1842480,"uuid":"2767032","full_name":"commonsguy/cwac-anddown","owner":"commonsguy","description":"CWAC AndDown: Markdown Utility Library","archived":false,"fork":false,"pushed_at":"2019-05-04T15:03:18.000Z","size":176,"stargazers_count":241,"open_issues_count":1,"forks_count":40,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-04T21:09:06.024Z","etag":null,"topics":["android","android-library","markdown","markdown-converter"],"latest_commit_sha":null,"homepage":"http://commonsware.com/cwac","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"decore/list.de-core.net","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commonsguy.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-13T16:09:11.000Z","updated_at":"2025-04-20T09:26:10.000Z","dependencies_parsed_at":"2022-08-20T08:10:58.991Z","dependency_job_id":null,"html_url":"https://github.com/commonsguy/cwac-anddown","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonsguy%2Fcwac-anddown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonsguy%2Fcwac-anddown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonsguy%2Fcwac-anddown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonsguy%2Fcwac-anddown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commonsguy","download_url":"https://codeload.github.com/commonsguy/cwac-anddown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252399513,"owners_count":21741672,"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":["android","android-library","markdown","markdown-converter"],"created_at":"2025-05-04T21:09:10.753Z","updated_at":"2025-05-04T21:09:11.295Z","avatar_url":"https://github.com/commonsguy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"CWAC AndDown: Markdown. Android. Perfect Together.\n==================================================\n\nMarkdown is a popular markup language for wikitext and the like.\nWhile there are Java-based Markdown processors available, these are\nlikely to be slow on Android, where they run at all.\n\nThis project offers an Android-compliant wrapper around [hoedown](https://github.com/hoedown/hoedown),\na C-based Markdown parser and HTML generator. By using the NDK with this\nC library, parsing speeds are nice and fast -- 5K of input can be\nconverted into HTML in about 1 millisecond.\n\nIf your objective is to put the results of Markdown in a `TextView`, or something\nelse in Android that understands `Spanned` objects, you are perhaps better served\nusing [Markwon](https://github.com/noties/Markwon).\nThat project goes straight from Markdown to a `Spanned`, bypassing HTML.\n\nIf you would prefer a Markdown-\u003eHTML converter that does not involve native code,\nconsider [commonmark-java](https://github.com/atlassian/commonmark-java).\n\nInstallation\n------------\nOption #1: Clone the repository and add the `anddown/` subdirectory as an Android library project to your\napplication. You will also need to install the NDK and run `ndk-build`\nfrom the project root directory, in order to build the `.so` file.\n\nOption #2: Use the AAR artifact for use with Gradle. To use that, add the following\nblocks to your `build.gradle` file:\n\n```groovy\nrepositories {\n    maven {\n        url \"https://s3.amazonaws.com/repo.commonsware.com\"\n    }\n}\n\ndependencies {\n    compile 'com.commonsware.cwac:anddown:0.4.0'\n}\n```\n\nOr, if you cannot use SSL, use `http://repo.commonsware.com` for the repository\nURL.\n\nThe AAR artifact contains compiled binaries for all CPU architectures, so you do\nnot need the NDK to use the library. You will need it if you want to build the\nlibrary from source code.\n\nUsage\n-----\nCreate an instance of `com.commonsware.cwac.anddown.AndDown`, then call\n`markdownToHtml()` on it, supplying\na `String` containing your Markdown source. This method returns a `String`\ncontaining HTML generated from that source.\n\n```java\nAndDown andDown=new AndDown();\n\nString result=andDown.markdownToHtml(\"Hello, world\");\n```\n\nThere is also a three-parameter version of `markdownToHtml()`, taking a pair\nof `int` values after the Markdown. The first represents a bitfield of \"extensions\"\nthat hoedown offers; the second represents a bitfield of \"flags\" to the HTML\ngenerator in hoedown.\n\n```java\nAndDown andDown=new AndDown();\n\nString result=andDown.markdownToHtml(\"This \\\"contains\\\" a quote\", AndDown.HOEDOWN_EXT_QUOTE, 0);\n```\n\nThe [AndDown source](https://github.com/commonsguy/cwac-anddown/blob/master/anddown/src/com/commonsware/cwac/anddown/AndDown.java)\nshows the available values for the extensions and flags. In terms of what\nthey mean... hoedown does not really document them. YMMV.\n\nAnd, that's pretty much it, at least at this time.\n\nThere is no statefulness in the `AndDown` object. It should be reusable\nwithout having to create a fresh instance each time. It might even\nbe thread-safe, though this has not been tested.\n\nUpgrading\n---------\nUpgrading to v0.3.0 from earlier versions should work without changes, except\nthat the `minSdkVersion` of the library is now 8 instead of 7. If you are\nstill supporting API Level 7, you are a saint, insane, or possibly both.\n\nLimitations\n-----------\nThe Markdown spec says that Markdown converted to HTML should use\n`\u003cem\u003e` and `\u003cstrong\u003e` tags. On most browsers, those map to italics and\nboldface, respectively. However, the `Html.fromHtml()` method in Android\nthat creates a `SpannedString` from HTML source flips those, so what you\nmight be used to seeing in boldface turns into italics and vice-versa.\nThis should only be an issue if you are displaing the Markdown-generated\nHTML in a `TextView` \u0026mdash; `WebView` in particular should behave more\nnormally.\n\nAlso, while hoedown is very fast, using the resulting HTML will inevitably\nbe slower. The same 5K sample file that hoedown processes in about 1\nmillisecond takes a 100+ milliseconds to convert into a `SpannedString`\nvia `Html.fromHtml()`.\n\nThe author of this project is a complete klutz when it comes to C/JNI/NDK\ndevelopment. You have been warned.\n\nDependencies\n------------\nThis project has no dependencies. This repository includes a copy of the\nrelevant files from the hoedown project.\n\nThis project should work on API Level 8 and higher \u0026mdash; please report\nbugs if you find otherwise.\n\nVersion\n-------\nThe latest version of this library is **v0.4.0**. Um, yay?\n\nDemo\n----\nIn the `demo/` sub-project you will find\na sample activity that demonstrates the use of `AndDown`, loading the\nhoedown README out of a raw resource and displaying it in a `TextView`\nwrapped in a `ScrollView`.\n\nAdditional Documentation\n------------------------\n[JavaDocs are available](http://javadocs.commonsware.com/cwac/anddown/index.html),\nthough since the API is pretty limited, there is little information to be\nfound there.\n\n[The Busy Coder's Guide to Android Development](https://commonsware.com/Android)\ncontains a chapter on the NDK that includes coverage of\nthis library.\n\nLicense\n-------\nThe code in this project is licensed under the Apache\nSoftware License 2.0, per the terms of the included LICENSE\nfile.\n\nThe hoedown source code is available under [its own license](https://github.com/hoedown/hoedown/blob/master/LICENSE),\nwhich appears to be a modified BSD license.\n\nQuestions\n---------\nIf you have questions regarding the use of this code, please post a question\non [StackOverflow](http://stackoverflow.com/questions/ask) tagged with\n`commonsware-cwac` and `android` after [searching to see if there already is an answer](https://stackoverflow.com/search?q=[commonsware-cwac]+anddown). Be sure to indicate\nwhat CWAC module you are having issues with, and be sure to include source code \nand stack traces if you are encountering crashes.\n\nYou are also welcome to join\n[the CommonsWare Community](https://community.commonsware.com/)\nand post questions\nand ideas to [the CWAC category](https://community.commonsware.com/c/cwac).\n\nIf you have encountered what is clearly a bug, please post an [issue](https://github.com/commonsguy/cwac-anddown/issues). Be certain to include complete steps\nfor reproducing the issue.\nThe [contribution guidelines](CONTRIBUTING.md)\nprovide some suggestions for how to create a bug report that will get\nthe problem fixed the fastest.\n\nDo not ask for help via social media.\n\nRelease Notes\n-------------\n- v0.4.0: updated to CMake-based build\n- v0.3.0: reorganized code to Android Studio-standard structure, added stub test suite, exposed hoedown's \"extensions\" and \"flags\"\n- v0.2.4: added 64-bit x86 and ARM support\n- v0.2.3: better `Android.mk`, updated to `hoedown` 3.0.1\n- v0.2.2: updated for Android Studio 1.0 and new AAR publishing system\n- v0.2.1: updated Gradle, fixed manifest for merging\n- v0.2.0: migrated to hoedown and Gradle\n- v0.1.1: added `Application.mk` to support both x86 and ARM\n- v0.1.0: initial release\n\nWho Made This?\n--------------\n\u003ca href=\"http://commonsware.com\"\u003e![CommonsWare](http://commonsware.com/images/logo.png)\u003c/a\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonsguy%2Fcwac-anddown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonsguy%2Fcwac-anddown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonsguy%2Fcwac-anddown/lists"}