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
Change regex to work directly on html-escaped string
  • Loading branch information
Jacco-V committed Jul 4, 2022
commit 79e738ace57d2b3f2baaaef40344d7ac514ae9d2
6 changes: 2 additions & 4 deletions src/core/render/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ export function getAndRemoveConfig(str = '') {

if (str) {
str = str
.replace(/"/g, '"')
.replace(
/(?:^|\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 :-(
/(?:^|\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(/^('|")|('|")$/g, '')
.replace(/"/g, '"')
.trim();
}

Expand Down
0