Skip to content

Commit

Permalink
dev mode rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Jun 27, 2024
1 parent eb1ba54 commit 1829a5c
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 35 deletions.
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"rehype-slug-custom-id": "^2.0.0",
"rehype-stringify": "^10.0.0",
"remark": "^15.0.1",
"remark-gemoji": "^8.0.0",
"remark-gfm": "^4.0.0",
"remark-github-blockquote-alert": "^1.2.1",
"remark-rehype": "^11.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h5>Guides</h5>
<div class="col-6 col-md">
<h5>Resources</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary text-decoration-none" href="/develop">Development</a></li>
<li><a class="link-secondary text-decoration-none" href="/develop">Develop</a></li>
</ul>
</div>
<div class="col-6 col-md">
Expand Down
2 changes: 1 addition & 1 deletion src/partials/page-toc.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button class="btn toc-toggle" type="button" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<button class="btn toc-toggle px-2" type="button" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-list-ul h2"></i>
</button>
<aside id="page-toc" class="toc ps-md-3 dropdown-menu mx-2 mx-md-0">
Expand Down
4 changes: 2 additions & 2 deletions src/partials/page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
{{> navbar }}
<main class="bg-dark-subtle page">
<div class="page-content container py-4">
<article data-bs-spy="scroll" data-bs-target="#page-toc" data-bs-smooth-scroll="true"
data-bs-root-margin="-20% 0px 80%">
<article data-bs-spy="scroll" data-bs-target="#page-toc" data-bs-smooth-scroll="false"
data-bs-root-margin="-65px 0px -90%" data-bs-threshold="[0]">
{{> @partial-block }}
</article>
{{#toc}}
Expand Down
16 changes: 8 additions & 8 deletions src/scss/components/callout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@extend .border-end-0;

.callout-title {
@extend .mt-2;
@extend .mb-1;

svg.octicon {
Expand Down Expand Up @@ -52,18 +53,22 @@
}

&.callout-important {
border-color: $purple-400 !important;
--bs-primary-rgb: #{to-rgb($purple-400)};

@extend .border-primary;

.callout-title {
color: $purple-400 !important;
@extend .text-primary;

svg.octicon {
fill: $purple-400;
fill: rgba(var(--bs-primary-rgb), var(--bs-text-opacity));
}
}
}

&.callout-note {
--bs-info-rgb: #{to-rgb($blue-600)};

@extend .border-info;

.callout-title {
Expand All @@ -88,8 +93,3 @@
}

}

.callout-title {
@extend .mt-2;
@extend .fw-bold;
}
4 changes: 2 additions & 2 deletions src/scss/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ main.page {

&:not(:only-child) {
h1 {
margin-inline-start: 1em;
margin-inline-start: 1.25em;
}
}
}
Expand All @@ -42,7 +42,7 @@ main.page {

.toc-toggle {
position: absolute;
margin-inline-start: -1em;
margin-inline-start: -0.5em;
margin-block-start: -0.25em;
}

Expand Down
4 changes: 2 additions & 2 deletions src/views/develop.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#> page title="Development"}}
<h1>Development</h1>
{{#> page title="Develop"}}
<h1>Develop</h1>
<p>
Under construction.
</p>
Expand Down
Binary file added src/views/devmode/Dev_Mode_Status_On_qqzjd4.webp
Binary file not shown.
Binary file not shown.
Binary file added src/views/devmode/contentstore.devmode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/contentstore.search_box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/contentstore.search_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 24 additions & 6 deletions src/views/devmode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,39 @@ Use officially supported development mode to install homebrew apps and games.

### Get a Developer Account

You'll need a developer account to use Developer Mode.
Please read <a href="https://webostv.developer.lge.com/develop/getting-started/preparing-lg-account">
Preparing LG Account</a> for creating one.
1. Visit [webOS TV Developer](https://webostv.developer.lge.com/), select "Sign In"
![webOS TV Developer Home](webos.tv.developer_home.png?width=600)
2. You will be redirected to LG Account login page. If you don't have an account, select "CREATE ACCOUNT"
![LG Account Login](lgaccount.sign_in.png?as=webp)
3. You'll see a pop-up window. Select country and click "CONFIRM"
![LG Account Select Country](lgaccount.select_country.png?width=600)
4. Accept terms & conditions and click "AGREE"
![LG Account Terms & Conditions](lgaccount.terms.png?as=webp)
5. Input your email address and password, check required checkboxes, and click "CONFIRM"
![LG Account Create Account](lgaccount.create_account.png?as=webp)
6. You'll receive an email to verify your email address. Click the link in the email to verify your email
address. ![LG Account Verify Email](lgaccount.verified.png?as=webp)
7. Go back to the LG Account login page and login with your email and password
![LG Account Login](lgaccount.sign_in_2.png?as=webp)

Now you'll be able to use this account to log in to Developer Mode app on your TV.

### Install Developer Mode App

1. Open LG Content Store
2. Search for "Developer Mode"
3. Select "Install"
1. Open LG Content Store, search for "Developer Mode"
![LG Content Store](contentstore.search_box.png?as=webp)
2. Select "Developer Mode" app
![Developer Mode App](contentstore.search_result.png?as=webp)
3. Click "Install" to download and install the app
![Developer Mode App Install](contentstore.devmode.png?as=webp)

### Enable Developer Mode

1. Launch Developer Mode app
2. Login to Developer Mode app with developer account
![Developer Mode Login](Login_of_Dev_Mode_App_l87hq9.webp)
3. Enable Developer Mode and wait for TV to restart
![Developer Mode Enable](Dev_Mode_Status_On_qqzjd4.webp)

### Prepare for Device Setup

Expand Down
Binary file added src/views/devmode/lgaccount.create_account.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/lgaccount.select_country.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/lgaccount.sign_in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/lgaccount.sign_in_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/lgaccount.terms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/lgaccount.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/views/devmode/webos.tv.developer_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion webpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ export default function (env, argv) {
}),
new FaviconsBundlerPlugin({
enabled: true,
faviconOptions: {
path: '/img/favicons',
display: 'browser',
theme_color: '#212529',
icons: {
appleStartup: false,
}
}
}),
...(argv.mode === 'production' ? [new PurgeCSSPlugin({
paths: () => fs.readdirSync(path.resolve('src'), {recursive: true})
Expand Down Expand Up @@ -140,7 +148,6 @@ export default function (env, argv) {
options: {
minimizer: [
{
// resize works only with `sharpMinify`
implementation: ImageMinimizerPlugin.imageminMinify,
options: {
plugins: [
Expand Down
17 changes: 6 additions & 11 deletions webpack/extract-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,17 @@ function extractToc(tree, title) {
const toc = {title, id: '', depth: 1, children: []};
const children = toc.children;
let current;
visit(tree, /**@param node {Element}*/(node) => node.tagName === 'section',
visit(tree, /**@param node {Element}*/(node) => node.tagName?.match(/h[2-4]/),
/**
* @param section {Element}
* @param heading {Element}
* @param index {number}
* @param parent {Element}
*/
(section, index, parent) => {
/** @type {Element} */
const firstChild = section.children[0];
if (!firstChild?.tagName) {
return;
}
(heading, index, parent) => {
const item = {
title: toString(firstChild),
id: section.properties.id,
level: firstChild.tagName.match(/h([1-6])/)[1] - 0
title: toString(heading),
id: heading.properties.id || parent.properties.id,
level: heading.tagName.match(/h([1-6])/)[1] - 0
};
if (item.level > current?.level) {
current.children = current.children || [];
Expand Down
6 changes: 5 additions & 1 deletion webpack/markdown-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import {remark} from 'remark';
import remarkGfm from 'remark-gfm';
import {remarkAlert} from 'remark-github-blockquote-alert';
import remarkSectionize from 'remark-sectionize';
import remarkGemoji from 'remark-gemoji';
import remarkRehype from 'remark-rehype';

import rehypeRaw from 'rehype-raw';
import rehypeSlug from 'rehype-slug';
import rehypeStringify from 'rehype-stringify';

import {visit} from 'unist-util-visit';
import {capitalize} from 'lodash-es';
import extractMeta from "./extract-meta.js";
Expand Down Expand Up @@ -94,6 +97,7 @@ const parser = remark()
.use(remarkGfm)
.use([remarkAlert, alertRestyle])
.use(remarkSectionize)
.use(remarkGemoji)
.use(remarkRehype, {allowDangerousHtml: true})
.use(rehypeRaw)
.use(rehypeSlug)
Expand All @@ -103,7 +107,7 @@ const parser = remark()
.use(headingHr)
.use(blockQuoteStyle)
.use(extractMeta)
.use(rehypeStringify);
.use(rehypeStringify, {allowDangerousCharacters: true, allowDangerousHtml: true});

/**
* @this {import('webpack').LoaderContext}
Expand Down

0 comments on commit 1829a5c

Please sign in to comment.