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

CED-1764: fix code display and line numbers #1527

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 8 additions & 7 deletions es-ds-docs/pages/atoms/color.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ const yellowTints = slice(sassYellows, ['yellow-400', 'yellow-300', 'yellow-200'
const { $prism } = useNuxtApp();
const docCode = ref('');

if ($prism) {
/* eslint-disable import/no-webpack-loader-syntax, import/no-self-import */
const docSource = await import('./color.vue?raw');
/* eslint-enable import/no-webpack-loader-syntax, import/no-self-import */
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./color.vue?raw');

docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
15 changes: 8 additions & 7 deletions es-ds-docs/pages/atoms/corners.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ const borderRadius = computed(() => {
const { $prism } = useNuxtApp();
const docCode = ref('');

if ($prism) {
/* eslint-disable import/no-self-import */
const docSource = await import('./corners.vue?raw');
/* eslint-enable import/no-self-import */
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./corners.vue?raw');

docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
14 changes: 8 additions & 6 deletions es-ds-docs/pages/atoms/icons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ const docCode = ref('');

const { $prism } = useNuxtApp();

if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./icons.vue?raw');
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./icons.vue?raw');

docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
14 changes: 8 additions & 6 deletions es-ds-docs/pages/atoms/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ const breakpointTableItems = [
const { $prism } = useNuxtApp();
const docCode = ref('');

if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./layout.vue?raw');
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./layout.vue?raw');
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>
<template>
<div>
Expand Down
14 changes: 8 additions & 6 deletions es-ds-docs/pages/atoms/spacing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ const deprecatedSpacers = computed(() =>
const { $prism } = useNuxtApp();
const docCode = ref('');

if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./spacing.vue?raw');
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./spacing.vue?raw');
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
15 changes: 8 additions & 7 deletions es-ds-docs/pages/atoms/typography.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,14 @@ const calculateActualFontSize = (remStr) => {

const { $prism } = useNuxtApp();
const docCode = ref('');
if ($prism) {
/* eslint-disable import/no-webpack-loader-syntax, import/no-self-import */
const docSource = await import('./typography.vue?raw');
/* eslint-enable import/no-webpack-loader-syntax, import/no-self-import */
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./typography.vue?raw');
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
14 changes: 8 additions & 6 deletions es-ds-docs/pages/examples/form-field-validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ const getErrorMessage = (validatorName) => {

const { $prism } = useNuxtApp();
const docCode = ref('');
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./form-field-validation.vue?raw');
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./form-field-validation.vue?raw');

docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
14 changes: 8 additions & 6 deletions es-ds-docs/pages/examples/form-validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ const onSubmit = async () => {

const { $prism } = useNuxtApp();
const docCode = ref('');
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./form-validation.vue?raw');
onMounted(async () => {
if ($prism) {
// eslint-disable-next-line import/no-self-import
const docSource = await import('./form-validation.vue?raw');

docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
19 changes: 10 additions & 9 deletions es-ds-docs/pages/molecules/accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');

if ($prism) {
/* eslint-disable import/no-webpack-loader-syntax, import/no-self-import */
const compSource = await import('@energysage/es-ds-components/components/es-accordion-list.vue?raw');
const docSource = await import('./accordion.vue?raw');
/* eslint-enable import/no-webpack-loader-syntax, import/no-self-import */
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-accordion-list.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./accordion.vue?raw');

compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
19 changes: 10 additions & 9 deletions es-ds-docs/pages/molecules/badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');

if ($prism) {
// eslint-disable-next-line import/no-unresolved
const compSource = await import('@energysage/es-ds-components/components/es-badge.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./badge.vue?raw');
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-badge.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./badge.vue?raw');
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
19 changes: 10 additions & 9 deletions es-ds-docs/pages/molecules/breadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');

if ($prism) {
/* eslint-disable import/no-webpack-loader-syntax, import/no-self-import */
const compSource = await import('@energysage/es-ds-components/components/es-breadcrumbs.vue?raw');
const docSource = await import('./breadcrumbs.vue?raw');
/* eslint-enable import/no-webpack-loader-syntax, import/no-self-import */
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-breadcrumbs.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./breadcrumbs.vue?raw');

compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
18 changes: 10 additions & 8 deletions es-ds-docs/pages/molecules/button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ const propTableWidths = ref({
const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-button.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./button.vue?raw');
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-button.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./button.vue?raw');

compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
18 changes: 10 additions & 8 deletions es-ds-docs/pages/molecules/card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ const modalVisible = ref(false);
const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-card.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./card.vue?raw');
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-card.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./card.vue?raw');
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down
22 changes: 12 additions & 10 deletions es-ds-docs/pages/molecules/checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ const handleSelectAllToggle = () => {
const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-form-checkbox.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./checkbox.vue?raw');
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-form-checkbox.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./checkbox.vue?raw');

compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down Expand Up @@ -149,8 +151,8 @@ if ($prism) {

<ds-doc-source
:comp-code="compCode"
comp-source="es-vue-base/src/lib-components/EsFormMsg.vue"
comp-source="es-ds-components/components/es-form-checkbox.vue"
:doc-code="docCode"
doc-source="es-design-system/pages/molecules/es-form-msg.vue" />
doc-source="es-ds-docs/pages/molecules/checkbox.vue" />
</div>
</template>
21 changes: 11 additions & 10 deletions es-ds-docs/pages/molecules/collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ const { $prism } = useNuxtApp();
const compCode = ref('');
const docCode = ref('');

if ($prism) {
/* eslint-disable import/no-self-import */
const compSource = await import('@energysage/es-ds-components/components/es-collapse.vue?raw');
const docSource = await import('./collapse.vue?raw');
/* eslint-enable import/no-self-import */
onMounted(async () => {
if ($prism) {
const compSource = await import('@energysage/es-ds-components/components/es-collapse.vue?raw');
// eslint-disable-next-line import/no-self-import
const docSource = await import('./collapse.vue?raw');

compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
compCode.value = $prism.normalizeCode(compSource.default);
docCode.value = $prism.normalizeCode(docSource.default);
$prism.highlight();
}
});
</script>

<template>
Expand Down Expand Up @@ -219,7 +220,7 @@ if ($prism) {

<ds-doc-source
:comp-code="compCode"
comp-source="es-ds-components/src/lib-components/es-collapse.vue"
comp-source="es-ds-components/components/es-collapse.vue"
:doc-code="docCode"
doc-source="es-ds-docs/pages/molecules/es-collapse.vue" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion es-ds-docs/pages/molecules/data-table-simple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ onMounted(async () => {
</div>
<ds-doc-source
:comp-code="compCode"
comp-source="es-ds-components/src/lib-components/es-data-table-simple.vue"
comp-source="es-ds-components/components/es-data-table-simple.vue"
:doc-code="docCode"
doc-source="es-ds-docs/pages/molecules/data-table-simple.vue" />
</div>
Expand Down
Loading
Loading