hexo-util
Advanced tools
Comparing version 1.6.1 to 1.7.0
@@ -1,1 +0,1 @@ | ||
{"languages":["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","cpp","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","crmsh","crystal","cs","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nimrod","nix","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","tex","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"],"aliases":{"1c":"1c","abnf":"abnf","accesslog":"accesslog","actionscript":"actionscript","as":"actionscript","ada":"ada","angelscript":"angelscript","asc":"angelscript","apache":"apache","apacheconf":"apache","applescript":"applescript","osascript":"applescript","arcade":"arcade","cpp":"cpp","c":"cpp","cc":"cpp","h":"cpp","c++":"cpp","h++":"cpp","hpp":"cpp","hh":"cpp","hxx":"cpp","cxx":"cpp","arduino":"arduino","armasm":"armasm","arm":"armasm","xml":"xml","html":"xml","xhtml":"xml","rss":"xml","atom":"xml","xjb":"xml","xsd":"xml","xsl":"xml","plist":"xml","wsf":"xml","asciidoc":"asciidoc","adoc":"asciidoc","aspectj":"aspectj","autohotkey":"autohotkey","ahk":"autohotkey","autoit":"autoit","avrasm":"avrasm","awk":"awk","axapta":"axapta","bash":"bash","sh":"bash","zsh":"bash","basic":"basic","bnf":"bnf","brainfuck":"brainfuck","bf":"brainfuck","cal":"cal","capnproto":"capnproto","capnp":"capnproto","ceylon":"ceylon","clean":"clean","icl":"clean","dcl":"clean","clojure":"clojure","clj":"clojure","clojure-repl":"clojure-repl","cmake":"cmake","cmake.in":"cmake","coffeescript":"coffeescript","coffee":"coffeescript","cson":"coffeescript","iced":"coffeescript","coq":"coq","cos":"cos","cls":"cos","crmsh":"crmsh","crm":"crmsh","pcmk":"crmsh","crystal":"crystal","cr":"crystal","cs":"cs","csharp":"cs","c#":"cs","csp":"csp","css":"css","d":"d","markdown":"markdown","md":"markdown","mkdown":"markdown","mkd":"markdown","dart":"dart","delphi":"delphi","dpr":"delphi","dfm":"delphi","pas":"delphi","pascal":"delphi","freepascal":"delphi","lazarus":"delphi","lpr":"delphi","lfm":"delphi","diff":"diff","patch":"diff","django":"django","jinja":"django","dns":"dns","bind":"dns","zone":"dns","dockerfile":"dockerfile","docker":"dockerfile","dos":"dos","bat":"dos","cmd":"dos","dsconfig":"dsconfig","dts":"dts","dust":"dust","dst":"dust","ebnf":"ebnf","elixir":"elixir","elm":"elm","ruby":"ruby","rb":"ruby","gemspec":"ruby","podspec":"ruby","thor":"ruby","irb":"ruby","erb":"erb","erlang-repl":"erlang-repl","erlang":"erlang","erl":"erlang","excel":"excel","xlsx":"excel","xls":"excel","fix":"fix","flix":"flix","fortran":"fortran","f90":"fortran","f95":"fortran","fsharp":"fsharp","fs":"fsharp","gams":"gams","gms":"gams","gauss":"gauss","gss":"gauss","gcode":"gcode","nc":"gcode","gherkin":"gherkin","feature":"gherkin","glsl":"glsl","gml":"gml","GML":"gml","go":"go","golang":"go","golo":"golo","gradle":"gradle","groovy":"groovy","haml":"haml","handlebars":"handlebars","hbs":"handlebars","html.hbs":"handlebars","html.handlebars":"handlebars","haskell":"haskell","hs":"haskell","haxe":"haxe","hx":"haxe","hsp":"hsp","htmlbars":"htmlbars","http":"http","https":"http","hy":"hy","hylang":"hy","inform7":"inform7","i7":"inform7","ini":"ini","toml":"ini","irpf90":"irpf90","isbl":"isbl","java":"java","jsp":"java","javascript":"javascript","js":"javascript","jsx":"javascript","jboss-cli":"jboss-cli","wildfly-cli":"jboss-cli","json":"json","julia":"julia","julia-repl":"julia-repl","kotlin":"kotlin","kt":"kotlin","lasso":"lasso","ls":"livescript","lassoscript":"lasso","ldif":"ldif","leaf":"leaf","less":"less","lisp":"lisp","livecodeserver":"livecodeserver","livescript":"livescript","llvm":"llvm","lsl":"lsl","lua":"lua","makefile":"makefile","mk":"makefile","mak":"makefile","mathematica":"mathematica","mma":"mathematica","wl":"mathematica","matlab":"matlab","maxima":"maxima","mel":"mel","mercury":"mercury","m":"mercury","moo":"mercury","mipsasm":"mipsasm","mips":"mipsasm","mizar":"mizar","perl":"perl","pl":"perl","pm":"perl","mojolicious":"mojolicious","monkey":"monkey","moonscript":"moonscript","moon":"moonscript","n1ql":"n1ql","nginx":"nginx","nginxconf":"nginx","nimrod":"nimrod","nim":"nimrod","nix":"nix","nixos":"nix","nsis":"nsis","objectivec":"objectivec","mm":"objectivec","objc":"objectivec","obj-c":"objectivec","ocaml":"ocaml","ml":"sml","openscad":"openscad","scad":"openscad","oxygene":"oxygene","parser3":"parser3","pf":"pf","pf.conf":"pf","pgsql":"pgsql","postgres":"pgsql","postgresql":"pgsql","php":"php","php3":"php","php4":"php","php5":"php","php6":"php","php7":"php","plaintext":"plaintext","pony":"pony","powershell":"powershell","ps":"powershell","processing":"processing","profile":"profile","prolog":"prolog","properties":"properties","protobuf":"protobuf","puppet":"puppet","pp":"puppet","purebasic":"purebasic","pb":"purebasic","pbi":"purebasic","python":"python","py":"python","gyp":"python","ipython":"python","q":"q","k":"q","kdb":"q","qml":"qml","qt":"qml","r":"r","reasonml":"reasonml","re":"reasonml","rib":"rib","roboconf":"roboconf","graph":"roboconf","instances":"roboconf","routeros":"routeros","mikrotik":"routeros","rsl":"rsl","ruleslanguage":"ruleslanguage","rust":"rust","rs":"rust","sas":"sas","SAS":"sas","scala":"scala","scheme":"scheme","scilab":"scilab","sci":"scilab","scss":"scss","shell":"shell","console":"shell","smali":"smali","smalltalk":"smalltalk","st":"smalltalk","sml":"sml","sqf":"sqf","sql":"sql","stan":"stan","stata":"stata","do":"stata","ado":"stata","step21":"step21","p21":"step21","step":"step21","stp":"step21","stylus":"stylus","styl":"stylus","subunit":"subunit","swift":"swift","taggerscript":"taggerscript","yaml":"yaml","yml":"yaml","YAML":"yaml","tap":"tap","tcl":"tcl","tk":"tcl","tex":"tex","thrift":"thrift","tp":"tp","twig":"twig","craftcms":"twig","typescript":"typescript","ts":"typescript","vala":"vala","vbnet":"vbnet","vb":"vbnet","vbscript":"vbscript","vbs":"vbscript","vbscript-html":"vbscript-html","verilog":"verilog","v":"verilog","sv":"verilog","svh":"verilog","vhdl":"vhdl","vim":"vim","x86asm":"x86asm","xl":"xl","tao":"xl","xquery":"xquery","xpath":"xquery","xq":"xquery","zephir":"zephir","zep":"zephir"}} | ||
{"languages":["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","cpp","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","crmsh","crystal","cs","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nimrod","nix","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","tex","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"],"aliases":{"1c":"1c","abnf":"abnf","accesslog":"accesslog","actionscript":"actionscript","as":"actionscript","ada":"ada","angelscript":"angelscript","asc":"angelscript","apache":"apache","apacheconf":"apache","applescript":"applescript","osascript":"applescript","arcade":"arcade","cpp":"cpp","c":"arduino","cc":"arduino","h":"arduino","c++":"arduino","h++":"arduino","hpp":"arduino","hh":"arduino","hxx":"arduino","cxx":"arduino","arduino":"arduino","armasm":"armasm","arm":"armasm","xml":"xml","html":"xml","xhtml":"xml","rss":"xml","atom":"xml","xjb":"xml","xsd":"xml","xsl":"xml","plist":"xml","wsf":"xml","svg":"xml","asciidoc":"asciidoc","adoc":"asciidoc","aspectj":"aspectj","autohotkey":"autohotkey","ahk":"autohotkey","autoit":"autoit","avrasm":"avrasm","awk":"awk","axapta":"axapta","bash":"bash","sh":"bash","zsh":"bash","basic":"basic","bnf":"bnf","brainfuck":"brainfuck","bf":"brainfuck","cal":"cal","capnproto":"capnproto","capnp":"capnproto","ceylon":"ceylon","clean":"clean","icl":"clean","dcl":"clean","clojure":"clojure","clj":"clojure","clojure-repl":"clojure-repl","cmake":"cmake","cmake.in":"cmake","coffeescript":"coffeescript","coffee":"coffeescript","cson":"coffeescript","iced":"coffeescript","coq":"coq","cos":"cos","cls":"cos","crmsh":"crmsh","crm":"crmsh","pcmk":"crmsh","crystal":"crystal","cr":"crystal","cs":"cs","csharp":"cs","c#":"cs","csp":"csp","css":"css","d":"d","markdown":"markdown","md":"markdown","mkdown":"markdown","mkd":"markdown","dart":"dart","delphi":"delphi","dpr":"delphi","dfm":"delphi","pas":"delphi","pascal":"delphi","freepascal":"delphi","lazarus":"delphi","lpr":"delphi","lfm":"delphi","diff":"diff","patch":"diff","django":"django","jinja":"django","dns":"dns","bind":"dns","zone":"dns","dockerfile":"dockerfile","docker":"dockerfile","dos":"dos","bat":"dos","cmd":"dos","dsconfig":"dsconfig","dts":"dts","dust":"dust","dst":"dust","ebnf":"ebnf","elixir":"elixir","elm":"elm","ruby":"ruby","rb":"ruby","gemspec":"ruby","podspec":"ruby","thor":"ruby","irb":"ruby","erb":"erb","erlang-repl":"erlang-repl","erlang":"erlang","erl":"erlang","excel":"excel","xlsx":"excel","xls":"excel","fix":"fix","flix":"flix","fortran":"fortran","f90":"fortran","f95":"fortran","fsharp":"fsharp","fs":"fsharp","gams":"gams","gms":"gams","gauss":"gauss","gss":"gauss","gcode":"gcode","nc":"gcode","gherkin":"gherkin","feature":"gherkin","glsl":"glsl","gml":"gml","GML":"gml","go":"go","golang":"go","golo":"golo","gradle":"gradle","groovy":"groovy","haml":"haml","handlebars":"handlebars","hbs":"handlebars","html.hbs":"handlebars","html.handlebars":"handlebars","haskell":"haskell","hs":"haskell","haxe":"haxe","hx":"haxe","hsp":"hsp","htmlbars":"htmlbars","http":"http","https":"http","hy":"hy","hylang":"hy","inform7":"inform7","i7":"inform7","ini":"ini","toml":"ini","irpf90":"irpf90","isbl":"isbl","java":"java","jsp":"java","javascript":"javascript","js":"javascript","jsx":"javascript","jboss-cli":"jboss-cli","wildfly-cli":"jboss-cli","json":"json","julia":"julia","julia-repl":"julia-repl","kotlin":"kotlin","kt":"kotlin","lasso":"lasso","ls":"livescript","lassoscript":"lasso","ldif":"ldif","leaf":"leaf","less":"less","lisp":"lisp","livecodeserver":"livecodeserver","livescript":"livescript","llvm":"llvm","lsl":"lsl","lua":"lua","makefile":"makefile","mk":"makefile","mak":"makefile","mathematica":"mathematica","mma":"mathematica","wl":"mathematica","matlab":"matlab","maxima":"maxima","mel":"mel","mercury":"mercury","m":"mercury","moo":"mercury","mipsasm":"mipsasm","mips":"mipsasm","mizar":"mizar","perl":"perl","pl":"perl","pm":"perl","mojolicious":"mojolicious","monkey":"monkey","moonscript":"moonscript","moon":"moonscript","n1ql":"n1ql","nginx":"nginx","nginxconf":"nginx","nimrod":"nimrod","nim":"nimrod","nix":"nix","nixos":"nix","nsis":"nsis","objectivec":"objectivec","mm":"objectivec","objc":"objectivec","obj-c":"objectivec","ocaml":"ocaml","ml":"sml","openscad":"openscad","scad":"openscad","oxygene":"oxygene","parser3":"parser3","pf":"pf","pf.conf":"pf","pgsql":"pgsql","postgres":"pgsql","postgresql":"pgsql","php":"php","php3":"php","php4":"php","php5":"php","php6":"php","php7":"php","plaintext":"plaintext","pony":"pony","powershell":"powershell","ps":"powershell","ps1":"powershell","processing":"processing","profile":"profile","prolog":"prolog","properties":"properties","protobuf":"protobuf","puppet":"puppet","pp":"puppet","purebasic":"purebasic","pb":"purebasic","pbi":"purebasic","python":"python","py":"python","gyp":"python","ipython":"python","q":"q","k":"q","kdb":"q","qml":"qml","qt":"qml","r":"r","reasonml":"reasonml","re":"reasonml","rib":"rib","roboconf":"roboconf","graph":"roboconf","instances":"roboconf","routeros":"routeros","mikrotik":"routeros","rsl":"rsl","ruleslanguage":"ruleslanguage","rust":"rust","rs":"rust","sas":"sas","SAS":"sas","scala":"scala","scheme":"scheme","scilab":"scilab","sci":"scilab","scss":"scss","shell":"shell","console":"shell","smali":"smali","smalltalk":"smalltalk","st":"smalltalk","sml":"sml","sqf":"sqf","sql":"sql","stan":"stan","stata":"stata","do":"stata","ado":"stata","step21":"step21","p21":"step21","step":"step21","stp":"step21","stylus":"stylus","styl":"stylus","subunit":"subunit","swift":"swift","taggerscript":"taggerscript","yaml":"yaml","yml":"yaml","YAML":"yaml","tap":"tap","tcl":"tcl","tk":"tcl","tex":"tex","thrift":"thrift","tp":"tp","twig":"twig","craftcms":"twig","typescript":"typescript","ts":"typescript","vala":"vala","vbnet":"vbnet","vb":"vbnet","vbscript":"vbscript","vbs":"vbscript","vbscript-html":"vbscript-html","verilog":"verilog","v":"verilog","sv":"verilog","svh":"verilog","vhdl":"vhdl","vim":"vim","x86asm":"x86asm","xl":"xl","tao":"xl","xquery":"xquery","xpath":"xquery","xq":"xquery","zephir":"zephir","zep":"zephir"}} |
'use strict'; | ||
const camelCase = require('camel-case'); | ||
const { camelCase } = require('camel-case'); | ||
@@ -5,0 +5,0 @@ function getter(key) { |
'use strict'; | ||
const { parse, URL } = require('url'); | ||
const { toUnicode } = require('./punycode'); | ||
const { toUnicode } = require('punycode.js'); | ||
@@ -6,0 +6,0 @@ const safeDecodeURI = (str) => { |
'use strict'; | ||
const { toUnicode } = require('./punycode'); | ||
const { toUnicode } = require('punycode.js'); | ||
const { parse, URL } = require('url'); | ||
@@ -5,0 +5,0 @@ |
@@ -5,5 +5,7 @@ 'use strict'; | ||
const encodeURL = require('./encode_url'); | ||
const prettyUrls = require('./pretty_urls'); | ||
function fullUrlForHelper(path = '/') { | ||
if (path.startsWith('//')) return path; | ||
const pathRegex = /^(\/\/|http(s)?:)/; | ||
if (pathRegex.test(path)) return path; | ||
@@ -19,7 +21,8 @@ const { config } = this; | ||
const { trailing_index } = Object.assign({ | ||
trailing_index: true | ||
const prettyUrlsOptions = Object.assign({ | ||
trailing_index: true, | ||
trailing_html: true | ||
}, config.pretty_urls); | ||
if (!trailing_index) path = path.replace(/index\.html$/, ''); | ||
path = prettyUrls(path, prettyUrlsOptions); | ||
@@ -26,0 +29,0 @@ return path; |
@@ -5,3 +5,2 @@ 'use strict'; | ||
const alias = require('../highlight_alias.json'); | ||
const escapeHTML = require('./escape_html'); | ||
@@ -28,3 +27,2 @@ | ||
if (useHljs && !gutter) wrap = false; | ||
if (gutter && !wrap) wrap = true; // arbitrate conflict ("gutter:true" takes priority over "wrap:false") | ||
@@ -37,2 +35,13 @@ | ||
const lines = data.value.split('\n'); | ||
let numbers = ''; | ||
let content = ''; | ||
for (let i = 0, len = lines.length; i < len; i++) { | ||
let line = lines[i]; | ||
if (tab) line = replaceTabs(line, tab); | ||
numbers += `<span class="line">${Number(firstLine) + i}</span><br>`; | ||
content += formatLine(line, Number(firstLine) + i, mark, options); | ||
} | ||
let result = `<figure class="highlight${data.language ? ` ${data.language}` : ''}">`; | ||
@@ -44,19 +53,10 @@ | ||
result += '<table>'; | ||
result += '<table><tr>'; | ||
const lines = data.value.split('\n'); | ||
for (let i = 0, len = lines.length; i < len; i++) { | ||
let line = lines[i]; | ||
if (tab) line = replaceTabs(line, tab); | ||
let content = formatLine(line, Number(firstLine) + i, mark, options); | ||
result += '<tr>'; | ||
if (gutter) { | ||
result += `<td class="gutter"><pre><span class="line">${Number(firstLine) + i}</span></pre></td>`; | ||
} | ||
result += `<td class="code">${before}${content}${after}</td></tr>`; | ||
if (gutter) { | ||
result += `<td class="gutter"><pre>${numbers}</pre></td>`; | ||
} | ||
result += '</table></figure>'; | ||
result += `<td class="code">${before}${content}${after}</td>`; | ||
result += '</tr></table></figure>'; | ||
@@ -76,2 +76,3 @@ return result; | ||
res += '<br>'; | ||
return res; | ||
@@ -78,0 +79,0 @@ } |
@@ -10,2 +10,3 @@ 'use strict'; | ||
exports.decodeURL = require('./decode_url'); | ||
exports.deepMerge = require('./deep_merge'); | ||
exports.encodeURL = require('./encode_url'); | ||
@@ -24,2 +25,3 @@ exports.escapeDiacritic = require('./escape_diacritic'); | ||
exports.Permalink = require('./permalink'); | ||
exports.prettyUrls = require('./pretty_urls'); | ||
exports.relative_url = require('./relative_url'); | ||
@@ -26,0 +28,0 @@ exports.slugize = require('./slugize'); |
@@ -6,5 +6,7 @@ 'use strict'; | ||
const relative_url = require('./relative_url'); | ||
const prettyUrls = require('./pretty_urls'); | ||
function urlForHelper(path = '/', options) { | ||
if (path.startsWith('#') || path.startsWith('//')) return path; | ||
const pathRegex = /^(#|\/\/|http(s)?:)/; | ||
if (pathRegex.test(path)) return path; | ||
@@ -31,7 +33,8 @@ const { config } = this; | ||
const { trailing_index } = Object.assign({ | ||
trailing_index: true | ||
const prettyUrlsOptions = Object.assign({ | ||
trailing_index: true, | ||
trailing_html: true | ||
}, config.pretty_urls); | ||
if (!trailing_index) path = path.replace(/index\.html$/, ''); | ||
path = prettyUrls(path, prettyUrlsOptions); | ||
@@ -38,0 +41,0 @@ return path; |
{ | ||
"name": "hexo-util", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"description": "Utilities for Hexo.", | ||
@@ -47,5 +47,7 @@ "main": "lib/index", | ||
"bluebird": "^3.5.2", | ||
"camel-case": "^3.0.0", | ||
"camel-case": "^4.0.0", | ||
"cross-spawn": "^7.0.0", | ||
"deepmerge": "^4.2.2", | ||
"highlight.js": "^9.13.1", | ||
"punycode.js": "^2.1.0", | ||
"striptags": "^3.1.1" | ||
@@ -52,0 +54,0 @@ }, |
@@ -19,2 +19,3 @@ # hexo-util | ||
- [decodeURL](#decodeurlstr) | ||
- [deepMerge](#deepmergetarget-source) | ||
- [encodeURL](#encodeurlstr) | ||
@@ -32,2 +33,3 @@ - [escapeDiacritic](#escapediacriticstr) | ||
- [Permalink](#permalinkrule-options) | ||
- [prettyUrls](#prettyurlsurl-options) | ||
- [relative_url](#relative_urlfrom-to) | ||
@@ -116,2 +118,24 @@ - [slugize](#slugizestr-options) | ||
### deepMerge(target, source) | ||
Merges the enumerable properties of two objects deeply. `target` and `source` remain untouched. | ||
``` js | ||
// Merge deeply | ||
const obj1 = {a: {b: 1, c: 1, d: {e: 1, f: 1}}}; | ||
const obj2 = {a: {b: 2, d: {f: 'f'} }}; | ||
deepMerge(obj1, obj2); | ||
// {a: {b: 2, c: 1, d: {e: 1, f: 'f'} }} | ||
``` | ||
``` js | ||
// Arrays will be combined in the same property, similar to lodash.merge | ||
const obj1 = { 'a': [{ 'b': 2 }, { 'd': 4 }] }; | ||
const obj2 = { 'a': [{ 'c': 3 }, { 'e': 5 }] }; | ||
deepMerge(obj1, obj2); | ||
// { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }; | ||
``` | ||
### encodeURL(str) | ||
@@ -343,2 +367,35 @@ | ||
### prettyUrls(url, [options]) | ||
Rewrite urls to pretty URLs. | ||
Option | Description | Default | ||
--- | --- | --- | ||
`trailing_index` | `/about/index.html -> /about/` when `false` | `true` | ||
`trailing_html` | `/about.html -> /about` when `false` | `true` | ||
Note: `trailing_html` ignores any link with a trailing `index.html`. (will not be rewritten to `index`). | ||
``` js | ||
prettyUrls('/foo/bar.html'); | ||
// /foo/bar.html | ||
prettyUrls('/foo/bar/index.html'); | ||
// /foo/bar/index.html | ||
prettyUrls('/foo/bar.html', { trailing_index: false }); | ||
// /foo/bar.html | ||
prettyUrls('/foo/bar/index.html', { trailing_index: false }); | ||
// /foo/bar/ | ||
prettyUrls('/foo/bar.html', { trailing_html: false }); | ||
// /foo/bar | ||
prettyUrls('/foo/bar/index.html', { trailing_html: false }); | ||
// /foo/bar/index.html | ||
prettyUrls('/foo/bar.html', { trailing_index: false, trailing_html: false }); | ||
// /foo/bar | ||
prettyUrls('/foo/bar/index.html', { trailing_index: false, trailing_html: false }); | ||
// /foo/bar/ | ||
``` | ||
### relative_url(from, to) | ||
@@ -345,0 +402,0 @@ |
32
614
69389
7
1148
+ Addeddeepmerge@^4.2.2
+ Addedpunycode.js@^2.1.0
+ Addedcamel-case@4.1.2(transitive)
+ Addeddeepmerge@4.3.1(transitive)
+ Addedlower-case@2.0.2(transitive)
+ Addedno-case@3.0.4(transitive)
+ Addedpascal-case@3.1.2(transitive)
+ Addedpunycode.js@2.3.1(transitive)
+ Addedtslib@2.6.3(transitive)
- Removedcamel-case@3.0.0(transitive)
- Removedlower-case@1.1.4(transitive)
- Removedno-case@2.3.2(transitive)
- Removedupper-case@1.1.3(transitive)
Updatedcamel-case@^4.0.0