This is a parser for Markdown-formatted text. It follows the following design guidelines:
- No C-library dependency
- Event-based, similar to
NSXMLParser
- Fully unit-tested (incl. code coverage)
- Supporting OS X and iOS
It’s a goal for this project to be developed using “test-driven development” (TDD). This is fancy talk for “write the unit test first, then code the implementation”.
Another is to, at some point in the not-too-distant future, provide input for DTCoreText to allow generating NSAttributedString
s directly from Markdown. Therefore the delegate protocol uses metaphors similar to those found in DTHTMLParser
.
Contributions are welcome, provided you use the following workflow:
- Create new unit tests for features you add (see
DTMarkdownparserTest
for examples) - All submissions are unit tested on Travis-CI and are only merged if all existing unit tests pass
- Please create an issue on GitHub before starting to code
- Work on a feature branch named like your_name/issue_123.
- Only submit pull requests against the develop branch
- When in doubt, just ask
This project is covered by a BSD 2-clause license. If you use it in a published app, you have to give some form of credit to Cocoanetics (like on your About screen). This requirement is lifted if you procure a Non-Attribution License from us.
- Basic Text
- Emphasis (strong, em)
- Strikethrough
- Inline Code
- Indented Code
- Fenced Code (GitHub-style)
- Horizontal Rule
- Headers
- Hyperlinks (inline and reference)
- Images (inline and reference)
- Linebreaks Handling (GitHub versus Gruber)
- Lists (ordered or unordered)
- Lists (stacked)
- Forced linking via angle brackets
- Automatic Linking of URLs (web and mail)
- Character Escaping
- Inline HTML (? should we ever do this ?)
- Multi-level Quoting and Code Blocks
- Additional Useful Markdown Extensions:
- MultiMarkdown Table support
- Proper Reporting of applicable processed range of text, e.g. to use for syntax highlighting
- John Gruber’s Markdown Syntax Documentation
- Stack Overflow’s Markdown Editing Help
- Fletcher T. Penney’s MultiMarkdown Syntax Guide