-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Features - Add ThemeIcon component - Add theme toggle code - Add new og tags - Add `remark-code-set` package - Add Footer to all pages - Increase post max width ### Changes - Update post layout format - Update light theme colors - Update text selection style - Update metadata - Update dependencies - Update astro expressive code to support themes - Update expressive code style - Update code highlight style - Update `remark-readme-status` background color - Replace `remark-codeset` with `remark-code-set` package - Remove old tab listener - Convert description color into root variable - Move comments to below related posts - Increase avatar size - Increase scrollbar width to 9px ### Fixes - PostRelated missing config and grid layout - Expressive code header with high z-index *Bump version to 1.7.0*
- Loading branch information
Showing
32 changed files
with
2,140 additions
and
1,486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "@lucjosin/remark-code-set", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"author": { | ||
"name": "Lucas Josino", | ||
"username": "LucJosin", | ||
"email": "[email protected]", | ||
"url": "https://lucasjosino.com" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"homepage": "https://github.com/LucJosin/lucasjosino.com", | ||
"bugs": { | ||
"url": "https://github.com/LucJosin/lucasjosino.com", | ||
"email": "[email protected]" | ||
}, | ||
"license": "MIT", | ||
"keywords": [ | ||
"remark-plugin", | ||
"remark-code-set" | ||
], | ||
"main": "src/index.js", | ||
"dependencies": { | ||
"hastscript": "^8.0.0", | ||
"remark": "^15.0.1", | ||
"unist-util-is": "^6.0.0", | ||
"unist-util-visit": "^5.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { parse } from 'node:querystring'; | ||
import { remark } from 'remark'; | ||
import { visit } from 'unist-util-visit'; | ||
|
||
const metaDelimiter = ' '; | ||
|
||
function createTabs(tabs, children) { | ||
return { | ||
type: 'wrapper', | ||
data: { | ||
hName: 'div', | ||
hProperties: { | ||
id: tabs, | ||
className: 'remark-code-tabs', | ||
}, | ||
}, | ||
children: children, | ||
}; | ||
} | ||
|
||
function createTab(childNode, group, index) { | ||
const tabId = `${group}#${index}`; | ||
const code = remark().parse(childNode).children[0]; | ||
const meta = parse(code.meta ?? '', metaDelimiter); | ||
|
||
return [ | ||
{ | ||
type: 'html', | ||
value: `<label for="${tabId}" class="remark-code-tab"> | ||
<input | ||
type="radio" | ||
id=${tabId} | ||
name="${group}" | ||
${index === 0 ? 'checked' : ''}/> | ||
<span>${meta.label}</span> | ||
</label>`, | ||
}, | ||
{ | ||
type: 'wrapper', | ||
data: { | ||
hName: 'div', | ||
hProperties: { | ||
className: 'remark-code-content', | ||
}, | ||
}, | ||
children: [code], | ||
}, | ||
]; | ||
} | ||
|
||
export default function remarkCodeTabs() { | ||
return function transform(tree) { | ||
visit(tree, 'code', function (node) { | ||
if (node.lang !== 'codeset') return; | ||
|
||
const meta = parse(node.meta ?? '', metaDelimiter); | ||
if (!meta.tabs) return; | ||
|
||
const codeList = node.value.split(':-:'); | ||
|
||
const tabs = []; | ||
for (let i = 0; i < codeList.length; i++) { | ||
tabs.push(...createTab(codeList[i], meta.tabs, i)); | ||
} | ||
|
||
// Create wrapper | ||
const newNode = createTabs(meta.tabs, [...tabs]); | ||
|
||
Object.assign(node, newNode); | ||
}); | ||
}; | ||
} |
Oops, something went wrong.