-
Notifications
You must be signed in to change notification settings - Fork 488
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
fix(livesample): support nolint aliases #7149
Conversation
Only one selector out of all three, Note: In exiting code two selectors do not work, only the first selector
I may be missing some historical context. |
@OnkarRuikar Can you give an example page that uses |
We haven't tagged any livesample code with For example this sample. We want to use the nolint alias on html block cos Prettier is completing the
|
@OnkarRuikar Could we try tackling this earlier during markdown-to-html conversion ( diff --git a/markdown/m2h/handlers/code.ts b/markdown/m2h/handlers/code.ts
index c12eee6ee..921e22dae 100644
--- a/markdown/m2h/handlers/code.ts
+++ b/markdown/m2h/handlers/code.ts
@@ -6,7 +6,7 @@ import u from "unist-builder";
*/
export function code(h, node) {
var value = node.value ? node.value + "\n" : "";
- const lang = node.lang;
+ const lang = node.lang.replace(/-nolint$/, '');
const meta = (node.meta || "").split(" ");
const props: { className?: string | string[] } = {}; |
3ef8061
to
9f726cf
Compare
@caugner good point! There is one possible, may be good, side effect. It will make yari oblivious to existence of yari/build/syntax-highlight.ts Lines 62 to 64 in 5c37bd3
|
Thank you, and good catch, feel free to open a follow-up PR (though I won't be able to review it before Monday)! 😉 |
Summary
Related to #7017
Recently we introduced new aliases
js-nolint
,html-nolint
, andcss-nolint
in order to avoid some code fences getting linted.But current live sample code doesn't recognize the new language tags.
Problem
The live sample code collector doesn't recognize
-nolint
language aliases.Solution
Widen the Cheerio CSS attribute style selector using wild card e.g.
pre[class*="${part}"]
How did you test this change?
Use same code for a live sample but with
-nolint
added to all language code fences.cc/ @caugner @teoli2003