var _typeof2 = require("../../@babel/runtime/helpers/typeof");
/**
*
* showdown: https://github.com/showdownjs/showdown
*
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/ function getDefaultOpts(simple) {
"use strict";
var defaultOptions = {
omitExtraWLInCodeBlocks: {
defaultValue: false,
describe: "Omit the default extra whiteline added to code blocks",
type: "boolean"
},
noHeaderId: {
defaultValue: false,
describe: "Turn on/off generated header id",
type: "boolean"
},
prefixHeaderId: {
defaultValue: false,
describe: "Specify a prefix to generated header ids",
type: "string"
},
headerLevelStart: {
defaultValue: false,
describe: "The header blocks level start",
type: "integer"
},
parseImgDimensions: {
defaultValue: false,
describe: "Turn on/off image dimension parsing",
type: "boolean"
},
simplifiedAutoLink: {
defaultValue: false,
describe: "Turn on/off GFM autolink style",
type: "boolean"
},
literalMidWordUnderscores: {
defaultValue: false,
describe: "Parse midword underscores as literal underscores",
type: "boolean"
},
strikethrough: {
defaultValue: false,
describe: "Turn on/off strikethrough support",
type: "boolean"
},
tables: {
defaultValue: false,
describe: "Turn on/off tables support",
type: "boolean"
},
tablesHeaderId: {
defaultValue: false,
describe: "Add an id to table headers",
type: "boolean"
},
ghCodeBlocks: {
defaultValue: true,
describe: "Turn on/off GFM fenced code blocks support",
type: "boolean"
},
tasklists: {
defaultValue: false,
describe: "Turn on/off GFM tasklist support",
type: "boolean"
},
smoothLivePreview: {
defaultValue: false,
describe: "Prevents weird effects in live previews due to incomplete input",
type: "boolean"
},
smartIndentationFix: {
defaultValue: false,
description: "Tries to smartly fix identation in es6 strings",
type: "boolean"
}
};
if (simple === false) {
return JSON.parse(JSON.stringify(defaultOptions));
}
var ret = {};
for (var opt in defaultOptions) {
if (defaultOptions.hasOwnProperty(opt)) {
ret[opt] = defaultOptions[opt].defaultValue;
}
}
return ret;
}
/**
* Created by Tivie on 06-01-2015.
*/
// Private properties
var showdown = {}, parsers = {}, extensions = {}, globalOptions = getDefaultOpts(true), flavor = {
github: {
omitExtraWLInCodeBlocks: true,
prefixHeaderId: "user-content-",
simplifiedAutoLink: true,
literalMidWordUnderscores: true,
strikethrough: true,
tables: true,
tablesHeaderId: true,
ghCodeBlocks: true,
tasklists: true
},
vanilla: getDefaultOpts(true)
};
/**
* helper namespace
* @type {{}}
*/ showdown.helper = {};
/**
* TODO LEGACY SUPPORT CODE
* @type {{}}
*/ showdown.extensions = {};
/**
* Set a global option
* @static
* @param {string} key
* @param {*} value
* @returns {showdown}
*/ showdown.setOption = function(key, value) {
"use strict";
globalOptions[key] = value;
return this;
};
/**
* Get a global option
* @static
* @param {string} key
* @returns {*}
*/ showdown.getOption = function(key) {
"use strict";
return globalOptions[key];
};
/**
* Get the global options
* @static
* @returns {{}}
*/ showdown.getOptions = function() {
"use strict";
return globalOptions;
};
/**
* Reset global options to the default values
* @static
*/ showdown.resetOptions = function() {
"use strict";
globalOptions = getDefaultOpts(true);
};
/**
* Set the flavor showdown should use as default
* @param {string} name
*/ showdown.setFlavor = function(name) {
"use strict";
if (flavor.hasOwnProperty(name)) {
var preset = flavor[name];
for (var option in preset) {
if (preset.hasOwnProperty(option)) {
globalOptions[option] = preset[option];
}
}
}
};
/**
* Get the default options
* @static
* @param {boolean} [simple=true]
* @returns {{}}
*/ showdown.getDefaultOptions = function(simple) {
"use strict";
return getDefaultOpts(simple);
};
/**
* Get or set a subParser
*
* subParser(name) - Get a registered subParser
* subParser(name, func) - Register a subParser
* @static
* @param {string} name
* @param {function} [func]
* @returns {*}
*/ showdown.subParser = function(name, func) {
"use strict";
if (showdown.helper.isString(name)) {
if (typeof func !== "undefined") {
parsers[name] = func;
} else {
if (parsers.hasOwnProperty(name)) {
return parsers[name];
} else {
throw Error("SubParser named " + name + " not registered!");
}
}
}
};
/**
* Gets or registers an extension
* @static
* @param {string} name
* @param {object|function=} ext
* @returns {*}
*/ showdown.extension = function(name, ext) {
"use strict";
if (!showdown.helper.isString(name)) {
throw Error("Extension 'name' must be a string");
}
name = showdown.helper.stdExtName(name);
// Getter
if (showdown.helper.isUndefined(ext)) {
if (!extensions.hasOwnProperty(name)) {
throw Error("Extension named " + name + " is not registered!");
}
return extensions[name];
// Setter
} else {
// Expand extension if it's wrapped in a function
if (typeof ext === "function") {
ext = ext();
}
// Ensure extension is an array
if (!showdown.helper.isArray(ext)) {
ext = [ ext ];
}
var validExtension = validate(ext, name);
if (validExtension.valid) {
extensions[name] = ext;
} else {
throw Error(validExtension.error);
}
}
};
/**
* Gets all extensions registered
* @returns {{}}
*/ showdown.getAllExtensions = function() {
"use strict";
return extensions;
};
/**
* Remove an extension
* @param {string} name
*/ showdown.removeExtension = function(name) {
"use strict";
delete extensions[name];
};
/**
* Removes all extensions
*/ showdown.resetExtensions = function() {
"use strict";
extensions = {};
};
/**
* Validate extension
* @param {array} extension
* @param {string} name
* @returns {{valid: boolean, error: string}}
*/ function validate(extension, name) {
"use strict";
var errMsg = name ? "Error in " + name + " extension->" : "Error in unnamed extension", ret = {
valid: true,
error: ""
};
if (!showdown.helper.isArray(extension)) {
extension = [ extension ];
}
for (var i = 0; i < extension.length; ++i) {
var baseMsg = errMsg + " sub-extension " + i + ": ", ext = extension[i];
if (_typeof2(ext) !== "object") {
ret.valid = false;
ret.error = baseMsg + "must be an object, but " + _typeof2(ext) + " given";
return ret;
}
if (!showdown.helper.isString(ext.type))
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
宝宝起名微信小程序2022最新版上线版,日新增用户100+,精选8000万宝宝姓名,参考为宝宝起个好名字。本小程序拥有多个广告位,已集成原生模板广告,激励视频广告,无插屏广告,在不影响用户体验的情况下保证广告利益最大化。本小程序无后台,部署简单,只需配置域名即可上传版本审核。喜欢记得评论收藏,您开发过程中遇到任何问题均可联系作者帮您提供帮助。祝您早日开通流量主。
资源推荐
资源详情
资源评论
收起资源包目录
宝宝起名最新版源码.rar (74个子文件)
baobei
@babel
runtime
helpers
typeof.js 388B
defineProperty.js 233B
arrayLikeToArray.js 201B
createForOfIteratorHelper.js 1KB
unsupportedIterableToArray.js 524B
interopRequireDefault.js 143B
utils
storage.js 2KB
util.js 8KB
http.js 3KB
wx_api.js 12KB
common.js 3KB
md5.js 8KB
wxParse
wxDiscode.js 7KB
showdown.js 76KB
htmlparser.js 6KB
wxParse.wxss 4KB
html2json.js 10KB
wxParse.js 6KB
wxParse.wxml 25KB
sitemap.json 201B
app.wxss 2KB
project.config.json 2KB
app.js 790B
pages
result
result.js 10KB
result.wxml 4KB
result.wxss 3KB
result.json 87B
webview
webview.js 1KB
webview.json 29B
webview.wxss 48B
webview.wxml 41B
index
index.wxml 3KB
index.js 7KB
index.wxss 3KB
index.json 29B
beixuan
beixuan.json 75B
beixuan.wxml 731B
beixuan.wxss 2KB
beixuan.js 3KB
common
tpl_tip_panel_view.wxss 0B
article_list.wxml 2KB
article_list.wxss 0B
tpl_mask_view.wxss 0B
tpl_mask_view.wxml 62B
tpl_user_wxlogin_view.wxss 0B
tpl_user_wxlogin_view.wxml 596B
tpl_tip_panel_view.wxml 313B
colorui
main.wxss 63KB
components
cu-custom.wxss 39B
cu-custom.js 857B
cu-custom.json 48B
cu-custom.wxml 859B
animation.wxss 3KB
icon.wxss 70KB
app.json 688B
images
result_heart.png 2KB
flower.png 3KB
close.png 1KB
arrowright.png 1KB
input_arrow.png 1KB
nv.png 19KB
input_box_bg.png 7KB
tip_ios.png 8KB
black_line.png 945B
test.png 6KB
test_bak.png 6KB
logo.gif 17KB
qiming.jpg 846KB
bgqm.jpg 97KB
ad_tip.png 74KB
bg.jpg 98KB
nan.png 16KB
to_share.png 14KB
test_sh.png 6KB
共 74 条
- 1
资源评论
- zxf8858482022-12-13果断支持这个资源,资源解决了当前遇到的问题,给了新的灵感,感谢分享~
- m0_742777412022-10-23发现一个宝藏资源,资源有很高的参考价值,赶紧学起来~
非常代码
- 粉丝: 0
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功