在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):xing/XNGMarkdownParser开源软件地址(OpenSource Url):https://github.com/xing/XNGMarkdownParser开源编程语言(OpenSource Language):Mercury 97.5%开源软件介绍(OpenSource Introduction):XNGMarkdownParser - A Markdown NSAttributedString ParserThis is a Markdown => NSAttributedString parser built on top of a flex parser. It takes an NSString and returns an NSAttributedString with markdown tags replaced by CoreText formatting attributes. This project is a fork of NSAttributedMarkdownParser by NimbusKit: https://github.com/NimbusKit/markdown Adding it to your ProjectUsing cocoapodsAdd Manual
Supported Features
Extended Features
Examples###Simplest example XNGMarkdownParser *parser = [[XNGMarkdownParser alloc] init];
NSAttributedString *string = [parser attributedStringFromMarkdownString:@"This is __rad__."]; Further text customization// this parser initializes only once and customizes fonts, line height and link color
+ (XNGMarkdownParser *)titleMarkdownParser {
static dispatch_once_t onceToken;
static XNGMarkdownParser *parser;
dispatch_once(&onceToken, ^{
parser = [[XNGMarkdownParser alloc] init];
parser.paragraphFont = [UIFont xng_14Font];
parser.boldFontName = [UIFont xng_14Font].fontName;
parser.linkFontName = [UIFont xng_14Font].fontName;
const CGFloat lineHeight = 18;
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.minimumLineHeight = lineHeight;
parser.topAttributes = @{
NSParagraphStyleAttributeName: paragraphStyle,
NSForegroundColorAttributeName: self.textColor
};
});
return parser;
} See the included Example project and the tests to check for further options. Want to collaborate?If you would like to collaborate with the project by adding features or fixing bugs, you can do it like this:
After you have fixed a bug or added a feature, please check the tests and extend them if needed, and you will be ready to create a pull request. Thanks! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论