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

feat(astro-org): optimise and display relative content images #104

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .changeset/dirty-bobcats-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"astro-org": major
"@uniorgjs/astro-example": major
---

feat(astro-org): optimize and display relative content images

- upgraded dependencies
- upgraded astro peerDependency
- breaking API change for astro plugin option
5 changes: 5 additions & 0 deletions .changeset/fresh-beers-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"uniorg-rehype": minor
---

chore(uniorg-rehype): update @types/hast
17 changes: 15 additions & 2 deletions examples/astro/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { defineConfig } from 'astro/config';
import org from 'astro-org'
import org from 'astro-org';
import rehypeShiftHeading from 'rehype-shift-heading';

import sitemap from '@astrojs/sitemap';

// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
integrations: [org(), sitemap()],
integrations: [
org({
rehypePlugins: [[rehypeShiftHeading, { shift: 1 }]],
uniorgRehypeOptions: {
handlers: {
'example-block': (org) => {
return h('pre.example', [{ type: 'text', value: org.value }]);
},
},
},
}),
sitemap(),
],
});
11 changes: 6 additions & 5 deletions examples/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.3.1",
"@astrojs/rss": "^3.0.0",
"@astrojs/sitemap": "^3.0.3",
"astro": "^3.5.3",
"@astrojs/check": "^0.5.10",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.2",
"astro": "^4.5.18",
"astro-org": "workspace:^",
"typescript": "^5.2.2"
"rehype-shift-heading": "^2.0.0",
"typescript": "^5.4.5"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion examples/astro/src/content/blog/org-style-guide.org
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.

** Headings
:PROPERTIES:
:ID: 3210541c-c891-4637-9ed7-2bafaef53260
:END:

The following HTML ~<h1>~—~<h6>~ elements represent six levels of section headings. ~<h1>~ is the highest section level while ~<h6>~ is the lowest.

Expand Down Expand Up @@ -36,8 +39,10 @@ Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sap
#+end_src

**** Output

***** Absolute
[[/blog-placeholder-about.jpg]]
***** Relative
[[./inline-placeholder.jpg]]

** Blockquotes

Expand Down
6 changes: 6 additions & 0 deletions examples/astro/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineCollection, z } from 'astro:content';

const blog = defineCollection({
type: 'content',
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),
Expand All @@ -9,6 +10,11 @@ const blog = defineCollection({
date: z.coerce.date(),
last_modified: z.coerce.date().optional(),
hero_image: z.string().optional(),
metadata: z
.object({
ids: z.record(z.string(), z.string()),
})
.optional(),
}),
});

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"eslint": "^8.53.0",
"@changesets/cli": "^2.27.1",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"prettier": "^3.1.0",
"ts-jest": "^29.1.1",
"turbo": "^1.10.16",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"turbo": "^1.13.2",
"typescript": "5.2.2"
}
}
28 changes: 18 additions & 10 deletions packages/astro-org/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,29 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"acorn": "^8.11.2",
"orgast-util-visit-ids": "^1.0.0",
"rollup-plugin-orgx": "^1.0.0",
"acorn": "^8.11.3",
"hast-util-to-html": "^9.0.1",
"orgast-util-visit-ids": "workspace:^",
"rehype-parse": "^9.0.0",
"rehype-stringify": "10.0.0",
"rollup-plugin-orgx": "workspace:^",
"unified": "^11.0.4",
"uniorg-extract-keywords": "^1.0.0",
"uniorg-parse": "^2.1.1",
"uniorg-slug": "^1.0.0",
"uniorg-extract-keywords": "workspace:^",
"uniorg-parse": "workspace:^",
"uniorg-rehype": "workspace:^",
"uniorg-slug": "workspace:^",
"unist-util-visit": "^5.0.0",
"vfile": "^6.0.1"
},
"devDependencies": {
"@types/node": "^20.9.0",
"astro": "^3.5.3",
"typescript": "^5.2.2"
"@types/hast": "3.0.4",
"@types/node": "^20.12.7",
"astro": "^4.5.18",
"typescript": "^5.4.5",
"uniorg": "workspace:^1.1.1",
"vite": "^5.2.8"
},
"peerDependencies": {
"astro": "^3.0.12"
"astro": "^4.5.18"
}
}
Loading
Loading