本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:
Ctrl + B
Ctrl + I
Ctrl + Q
Ctrl + L
Ctrl + K
Ctrl + G
Ctrl + H
Ctrl + O
Ctrl + U
Ctrl + R
Ctrl + Z
Ctrl + Y
Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面。 —— [ 维基百科 ]
使用简单的符号标识不同的标题,将某些文字标记为粗体或者斜体,创建一个链接等,详细语法参考帮助?。
本编辑器支持 Markdown Extra , 扩展了很多好用的功能。具体请参考Github.
Markdown Extra 表格语法:
项目 | 价格 |
---|---|
Computer | $1600 |
Phone | $12 |
Pipe | $1 |
可以使用冒号来定义对齐方式:
项目 | 价格 | 数量 |
---|---|---|
Computer | 1600 元 | 5 |
Phone | 12 元 | 12 |
Pipe | 1 元 | 234 |
定义 D
定义D内容
代码块语法遵循标准markdown代码,例如:
- (void)createNotification
{
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
//创建通知内容
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.body = [NSString localizedUserNotificationStringForKey:@"内容" arguments:nil];
content.title = [NSString localizedUserNotificationStringForKey:@"标题" arguments:nil];
content.subtitle = [NSString localizedUserNotificationStringForKey:@"副标题" arguments:nil];
content.userInfo = @{@"gf":@"yuanyuan"};
//附件
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"1" ofType:@"jpg"]];
UNNotificationAttachment *attachment = [UNNotificationAttachment attachmentWithIdentifier:@"iamgeAttachment"
URL:url
options:nil
error:nil];
content.attachments = @[attachment];
//快捷按钮
UNNotificationAction *action1 = [UNNotificationAction actionWithIdentifier:@"action1"
title:@"按钮"
options:UNNotificationActionOptionNone];
//快捷输入框
UNTextInputNotificationAction *action2 = [UNTextInputNotificationAction actionWithIdentifier:@"action2"
title:@"回复"
options:UNNotificationActionOptionNone
textInputButtonTitle:@"发送"
textInputPlaceholder:@"默认回复语句"];
UNNotificationCategory *category = [UNNotificationCategory categoryWithIdentifier:@"acategory"
actions:@[action1, action2]
intentIdentifiers:@[]
options:UNNotificationCategoryOptionCustomDismissAction];
content.categoryIdentifier = @"acategory";
NSSet *set = [NSSet setWithObject:category];
[center setNotificationCategories:set];
//创建触发器
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:3 repeats:NO];
//创建请求,并投递
UNNotificationRequest * request = [UNNotificationRequest requestWithIdentifier:@"stoneNotifacation"
content:content
trigger:trigger];
[center addNotificationRequest:request withCompletionHandler:nil];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef __IPHONE_10_0
UNAuthorizationOptions options = UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert;
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:options
completionHandler:^(BOOL granted, NSError *error) {
//取得授权
if(granted)
{
//获取权限信息
[center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings *settings)
{
NSLog(@"权限%d",(int)settings.authorizationStatus);
}];
//创建通知
[self createNotification];
}
//未取得授权
else
{
}
}];
#endif
[[UIApplication sharedApplication] registerForRemoteNotifications];
//app未启动的情况下收到通知
id obj;
if((obj = launchOptions[UIApplicationLaunchOptionsLocationKey]))
{
NSLog(@"本地通知 %@", obj);
}
else if((obj = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]))
{
NSLog(@"远程通知 %@", obj);
}
return YES;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
}
//通知到达时应用在前台时调用
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
NSLog(@"通知到达时应用在前台时调用: %@",notification.request.content.userInfo);
//配置前台可以显示的通知形式
completionHandler(UNNotificationPresentationOptionAlert);
}
//后台或前台点击通知时调用
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void(^)())completionHandler
{
NSLog(@"点击通知时调用 额外信息: %@",response.notification.request.content.userInfo);
if([response isKindOfClass:[UNTextInputNotificationResponse class]])
{
UNTextInputNotificationResponse *textResponse = (UNTextInputNotificationResponse *)response;
NSLog(@"点击通知时调用 输入框: %@",textResponse.userText);
}
else
{
NSLog(@"点击通知时调用 按钮: %@",response.actionIdentifier);
}
[center removeDeliveredNotificationsWithIdentifiers:@[response.notification.request.identifier]];
completionHandler();
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"didReceiveRemoteNotification:%@",userInfo);
}
... prompt'''
生成一个脚注1.
用 [TOC]
来生成目录:
使用MathJax渲染LaTex 数学公式,详见math.stackexchange.com.
更多LaTex语法请参考 这儿.
可以渲染序列图:
或者流程图:
即使用户在没有网络的情况下,也可以通过本编辑器离线写博客(直接在曾经使用过的浏览器中输入write.blog.csdn.net/mdeditor即可。Markdown编辑器使用浏览器离线存储将内容保存在本地。
用户写博客的过程中,内容实时保存在浏览器缓存中,在用户关闭浏览器或者其它异常情况下,内容不会丢失。用户再次打开浏览器时,会显示上次用户正在编辑的没有发表的内容。
博客发表后,本地缓存将被删除。
用户可以选择 把正在写的博客保存到服务器草稿箱,即使换浏览器或者清除缓存,内容也不会丢失。
注意:虽然浏览器存储大部分时候都比较可靠,但为了您的数据安全,在联网后,请务必及时发表或者保存到服务器草稿箱。