Skip to content

Commit

Permalink
feat: enhanced images
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Jan 3, 2024
1 parent 66e6387 commit e5206b6
Show file tree
Hide file tree
Showing 9 changed files with 680 additions and 39 deletions.
5 changes: 4 additions & 1 deletion apps/demo/src/routes/playground/markdown/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Lists
Code fences
```

![Images](./image.jpeg?blur=0)
![Images](/favicon.png)

## Why create Markdoc instead of using an alternative?

### Why not MDX?
Expand All @@ -28,7 +31,7 @@ Code fences

Markdoc uses a fully declarative approach to composition and flow control, where MDX relies on JavaScript and React. This means MDX affords users more power and flexibility, but at the cost of complexity–content can quickly become as complex as regular code, which can lead to maintainability complications or a more difficult authoring environment.

One of the key motivations for creating Markdoc at Stripe was to create a format that is optimized for writing rather than programming so that we could overcome the challenges that resulted from mixing code and content in our legacy documentation platform. With Markdoc, contributors can iterate quickly without having to subject their edits to a code review and the standard of technical scrutiny that we would have to apply to a format that supports embedded JavaScript. Markdoc also helps us enforce stronger controls around presentation and page logic, avoiding situations in which one-off hacks and procedural content generation introduce bugs and unpredictable behavior.
One of the key motivations for creating Markdoc at Stripe was to create a format that is optimized for writing rather than programming so that we could overcome the challenges that resulted from mixing code and content in our legacy documentation platform. With Markdoc, contributors can iterate quickly without having to subject their edits to a code review and the standard of technical scrutiny that we would have to apply to a format that supports embedded JavaScript. Markdoc also helps us enforce stronger controls around presentation and page logic, avoiding situations in which one-off hacks and procedural content generation introduce bugs and unpredictable behavior.

Markdoc's first-class, declarative tag syntax integrates seamlessly with Markdown content and can make it simpler to handle content transforms, static analysis, and validation in a unified, lightweight manner. In MDX, some of these tasks require operating on a more complicated JavaScript AST and accounting for the full spectrum of JavaScript language features. MDX also has a significantly larger runtime dependency footprint and relies on a JavaScript parser to handle the embedded logic.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion apps/demo/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { enhancedImages } from '@sveltejs/enhanced-img';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sveltekit()],
plugins: [enhancedImages(), sveltekit()],
});
Loading

0 comments on commit e5206b6

Please sign in to comment.