Skip to content
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

updates to DocsShowCode component #358

Merged
merged 4 commits into from
Sep 22, 2022

Conversation

indirectlylit
Copy link
Contributor

@indirectlylit indirectlylit commented Sep 3, 2022

Description

Improves DocsShowCode component layout:

before after
image image

Allows example HTML and Vue code to be inserted verbatim, without escape sequences or eslint-disable directives:

-      <!-- eslint-disable -->
-      <!-- prevent prettier from changing indentation -->
      <DocsShowCode language="html">
-        &lt;KGrid&gt;
-          &lt;KGridItem :layout12="{ span: 9 }"&gt;
-            &lt;h2&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit&lt;/h2&gt;
-          &lt;/KGridItem&gt;
-          &lt;KGridItem :layout12="{ span: 3, alignment: 'right' }"&gt;
-            &lt;KButton text="Button" primary/&gt;
-          &lt;/KGridItem&gt;
-        &lt;/KGrid&gt;
+        <KGrid>
+          <KGridItem :layout12="{ span: 9 }">
+            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h2>
+          </KGridItem>
+          <KGridItem :layout12="{ span: 3, alignment: 'right' }">
+            <KButton text="Button" primary />
+          </KGridItem>
+        </KGrid>
      </DocsShowCode>
-      <!-- eslint-enable -->

(optional) Implementation notes

At a high level, how did you implement this?

Does this introduce any tech-debt items?

This doesn't resolve the need to wrap javascript and CSS code sample blocks with eslint-disable/eslint-enable, because otherwise the code formatter treats them as HTML text nodes and flattens indentation. This might be fixable with a custom eslint plugin rule which can tell eslint/prettier to treat contents of DocsShowCode differently.

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change has been added to the changelog

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

Post-merge updates and tracking

  • Learning Platform update PR is submitted
  • Learning Platform update PR is merged
  • Studio update PR is submitted
  • Studio update PR is merged
  • Data Portal update PR is submitted
  • Data Portal update PR is merged

Comments

@MisRob
Copy link
Member

MisRob commented Sep 5, 2022

Thank you, @indirectlylit :)

@MisRob MisRob self-requested a review September 21, 2022 13:39
CONFLICTS
docs/pages/kcheckbox.vue
Copy link
Member

@MisRob MisRob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @indirectlylit, everything's looking good to me. I merged the latest develop and updated place coming from there that still used &lt; and &gt;

@MisRob MisRob merged commit 92d6110 into learningequality:develop Sep 22, 2022
@indirectlylit
Copy link
Contributor Author

awesome, glad to help :)

marcellamaki added a commit that referenced this pull request Sep 23, 2022
Backport "updates to DocsShowCode component #358" to the release branch
@indirectlylit indirectlylit deleted the show-code branch October 4, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants