MCPcopy
hub / github.com/docsifyjs/docsify / getAndRemoveConfig

Function getAndRemoveConfig

src/core/render/utils.js:21–40  ·  view source on GitHub ↗
(str = '')

Source from the content-addressed store, hash-verified

19 * @return {object} The original string and parsed object, { str, config }.
20 */
21export function getAndRemoveConfig(str = '') {
22 const config = {};
23
24 if (str) {
25 str = str
26 .replace(/^('|")/, '')
27 .replace(/('|")$/, '')
28 .replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g, (m, key, value) => {
29 if (key.indexOf(':') === -1) {
30 config[key] = (value && value.replace(/"/g, '')) || true;
31 return '';
32 }
33
34 return m;
35 })
36 .trim();
37 }
38
39 return { str, config };
40}
41
42/**
43 * Remove the <a> tag from sidebar when the header with link, details see issue 1069

Callers 7

compileEmbedMethod · 0.90
_initRendererMethod · 0.90
imageCompilerFunction · 0.90
linkCompilerFunction · 0.90
headingCompilerFunction · 0.90
genIndexFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…