8000 feature: support customized sidebar item name from content by Jacco-V · Pull Request #1825 · docsifyjs/docsify · GitHub
[go: up one dir, main page]

Skip to content

feature: support customized sidebar item name from content #1825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix logic for html-escaped str argument
Because the provided `str` argument has been html-escaped, with backslashes stripped, we can unfortunately not support escaped characters in quoted strings.
  • Loading branch information
Jacco-V committed Jul 4, 2022
commit da7937e340ec44b514fc397b3c1b1734eb938952
9 changes: 5 additions & 4 deletions src/core/render/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@ export function getAndRemoveConfig(str = '') {

if (str) {
str = str
.replace(/"/g, '"')
.replace(
/(?:^|\s):([\w-]+:?)=?([\w-%]+|"(?:[^"\\]|\\.)*")?/g,
/(?:^|\s):([\w-]+:?)=?([\w-%]+|"[^"]*")?/g, // Note: because the provided `str` argument has been html-escaped, with backslashes stripped, we cannot support escaped characters in quoted strings :-(
(m, key, value) => {
if (key.indexOf(':') === -1) {
config[key] = (value && value.replace(/"/g, '')) || true;
config[key] = (value && value.replace(/"/g, '')) || true;
return '';
}

return m;
}
)
.replace(/^('|")/, '')
.replace(/('|")$/, '')
.replace(/^('|")|('|")$/g, '')
.replace(/"/g, '"')
.trim();
}

Expand Down
0