-
Notifications
You must be signed in to change notification settings - Fork 29
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
Document specifying beautifier config file, use Docusaurus tabs for code #211
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,49 +195,15 @@ export default class OptionsDoc extends Doc { | |
), | ||
).then(beautified => { | ||
builder.header("Examples", 2); | ||
builder.append( | ||
'<div class="input-group languages-select"><div class="input-group-prepend">', | ||
); | ||
builder.append( | ||
'<label class="input-group-text" for="languages-select">Select Language:</label>', | ||
); | ||
builder.append( | ||
'</div><select class="custom-select" id="languages-select">', | ||
); | ||
let defaultDisplay: string; | ||
let isDefault: boolean = true; | ||
this.languages.forEach(language => { | ||
const example = examplesForLanguages[language.name]; | ||
builder.append( | ||
`<option ${ | ||
example && isDefault ? 'selected="selected"' : "" | ||
} data-text="${ | ||
language.name | ||
}" value="${language.name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stevenzeck Before we had the direct links to select the appropriate tab: https://unibeautify.com/docs/option-end-with-newline.html?language=html Now the similar link will no longer select the code tab: https://deploy-preview-211--unibeautify.netlify.com/docs/option-end-with-newline.html?language=html I do want to continue to support this feature. |
||
.toLowerCase() | ||
.replace(/ /g, "")}">${language.name + | ||
(example ? " *" : "")}</option>`, | ||
); | ||
if (example && isDefault) { | ||
defaultDisplay = language.name; | ||
isDefault = false; | ||
} | ||
}); | ||
builder.append(`</select><div class="select__arrow"></div></div>`); | ||
builder.append("Invisible characters are shown with the following symbols:\n"); | ||
builder.append(Object.keys(invisiblesMap).map(invisibleName => { | ||
const visibleChar = invisiblesMap[invisibleName]; | ||
return (`<kbd>${optionKeyToTitle(invisibleName)}</kbd> = <kbd>${visibleChar}</kbd>`); | ||
}).join('; ') + '.'); | ||
builder.append('<!--DOCUSAURUS_CODE_TABS-->',); | ||
this.languages.forEach((language, languageIndex) => { | ||
const example = examplesForLanguages[language.name]; | ||
builder.append( | ||
`<div class="exampleCode${ | ||
language.name === defaultDisplay ? "" : " hidden" | ||
}" id="example-${language.name | ||
.toLowerCase() | ||
.replace(/ /g, "")}">\n`, | ||
); | ||
builder.append(`<!--${language.name}-->`); | ||
if (example) { | ||
builder.editButton( | ||
`Edit ${language.name} Example`, | ||
|
@@ -292,7 +258,6 @@ export default class OptionsDoc extends Doc { | |
builder.append(""); | ||
} | ||
}); | ||
|
||
if ( | ||
this.exampleValues.length > 1 && | ||
!beautifiedExamplesAreDifferent | ||
|
@@ -308,8 +273,8 @@ export default class OptionsDoc extends Doc { | |
); | ||
builder.append("No example found. Please submit a Pull Request!"); | ||
} | ||
builder.append(`</div>`); | ||
}); | ||
builder.append('<!--END_DOCUSAURUS_CODE_TABS-->'); | ||
}); | ||
}) | ||
.then(() => builder); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look great right now: https://deploy-preview-211--unibeautify.netlify.com/docs/options-for-beautifiers
Maybe could add a note about
prefer_beautifier_config
being of typeboolean | string
?And add a sub-section:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevenzeck Thoughts on moving this docs update into a separate smaller PR? I think the code tabs change is going to take more time.