Skip to content

Commit ce32410

Browse files
committed
Add remark-mark-plus as a refactored local component to allow using ===my marked text=== to wrap the 'my marked text' in <mark> elements
1 parent 1af0f9d commit ce32410

18 files changed

Lines changed: 417 additions & 66 deletions

File tree

‎.cache/pages.json‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,10 @@
2222
"contact",
2323
"offline",
2424
{
25-
"privacy": [
26-
"my-data"
27-
]
25+
"privacy": ["my-data"]
2826
},
2927
{
30-
"services": [
31-
"consulting",
32-
"overview",
33-
"web-development"
34-
]
28+
"services": ["consulting", "overview", "web-development"]
3529
},
3630
{
3731
"tags": [
@@ -67,4 +61,4 @@
6761
"typescript"
6862
]
6963
}
70-
]
64+
]

‎.markdownlint.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"MD004": false,
33
"MD013": false,
44
"MD025": false,
5+
"MD031": false,
56
"MD033": false,
67
"MD035": false,
78
"MD036": false,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
declare module '@adobe/mdast-util-gridtables' {
2-
export const TYPE_TABLE: string
2+
export const TYPE_TABLE: 'gridTable'
33

44
// This is a mdast-util-to-hast handler factory; typing varies by mdast-util-to-hast version.
55
// Keep it permissive to avoid coupling tests/build to internal types.
6-
export function mdast2hastGridTablesHandler(..._args: Array<unknown>): unknown
6+
export function mdast2hastGridTablesHandler(..._args: Array<unknown>): import('mdast-util-to-hast').Handler
77
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { Parent } from 'unist'
2+
3+
declare module 'mdast' {
4+
/** Custom node emitted by remark-captions / remark-attribution */
5+
interface Figure extends Parent {
6+
type: 'figure'
7+
children: Array<RootContent>
8+
}
9+
10+
/** Custom node emitted by remark-captions / remark-attribution */
11+
interface Figcaption extends Parent {
12+
type: 'figcaption'
13+
children: Array<PhrasingContent>
14+
}
15+
16+
/** Custom node emitted by @adobe/remark-gridtables */
17+
interface GridTable extends Parent {
18+
type: 'gridTable'
19+
children: Array<RootContent>
20+
}
21+
22+
interface RootContentMap {
23+
figure: Figure
24+
figcaption: Figcaption
25+
gridTable: GridTable
26+
}
27+
}

‎@types/remark-captions.d.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
declare module 'remark-captions' {
2+
import type { Plugin } from 'unified'
3+
import type { Root } from 'mdast'
4+
5+
export type RemarkCaptionsExternalNodeType = 'table' | 'code'
6+
export type RemarkCaptionsInternalNodeType = 'blockquote' | 'image'
7+
8+
export interface RemarkCaptionsOptions {
9+
external?: Partial<Record<RemarkCaptionsExternalNodeType, string>>
10+
internal?: Partial<Record<RemarkCaptionsInternalNodeType, string>>
11+
}
12+
13+
const remarkCaptions: Plugin<[RemarkCaptionsOptions?], Root>
14+
export default remarkCaptions
15+
}

‎_TODO.md‎

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -241,64 +241,24 @@ You can then opt-out of prefetching for individual links by setting data-astro-p
241241

242242
- `remark-attributes` does not work because `{...}` in MDX embeds dynamic JavaScript logic or JSX components directly within Markdown content
243243

244+
Must define escaping rules (what if the content legitimately includes `[[...]]`), and whether .md, .mdx, or both:
245+
244246
```markdown
245-
![Image](url){width=300 .centered}
247+
### Heading [[.my-class #my-id]]
248+
![Image](url) [[width=300 .centered]]
249+
[Link](url) [[.btn target=_blank]]
246250

247-
Variables: # {postTitle}.
248-
Calculations: {Math.PI * 2}.
249-
Components: { <MyComponent /> }
251+
### Heading[[.my-class #my-id]]
252+
![Image](url)[[width=300 .centered]]
253+
[Link](url)[[.btn target=_blank]]
250254
```
251255

252256
### Youtube embedding
253257

254258
- `rehype-video` for self-hosted videos, you have to pass the video filename into the unified `process()` pipeline along with the plugin
255259
- `@hongvanpc10/rehype-embed` works the same way - you have to pass the Youtube link into the config to be processed
256260

257-
### remark-captions
258-
259-
By default it wraps the elements code, image, table and blockquote in a `<figure>` element, and adds a `<figcaption>` block as the last child. You can configure it to work on other elements. You supply the keyword (by default Code, Figure, Table, and Source respectively) and to add a caption you add a line right below the element with that keyword:
260-
261-
```markdown
262-
> Some blockquote text that will have a caption
263-
Source: The caption text that will appear under the blockquote
264-
```
265-
266-
### Add Twitter like mentions in markdown using @twittername syntax
267-
268-
`markdown-it-mentions`
269-
270-
Options object including parse function for content generated by mentions plugin using `@twittername` syntax:
271-
272-
```javascript
273-
const markdownMentionsConfig = {
274-
parseURL: username => {
275-
return `https://twitter.com/@${username}`
276-
},
277-
/** adds a target="_blank" attribute if it's true and target="_self" if it's false */
278-
external: true,
279-
}
280-
```
281-
282-
### my-accessible-list-plugin
283261

284-
```typescript
285-
import { visit } from 'unist-util-visit';
286-
287-
export function myAccessibleListPlugin() {
288-
return (tree) => {
289-
visit(tree, 'list', (node) => {
290-
// Example: Add an aria-label to lists
291-
if (!node.data) {
292-
node.data = {}
293-
}
294-
if (!node.data.hProperties) {
295-
node.data.hProperties = {}
296-
}
297-
node.data.hProperties['aria-label'] = 'List of items'; // Customize this
298-
})
299-
}
300-
}
301-
```
302262

303263
### Custom version of the code block integration from Astro Docs. "Beautiful code blocks for your Astro site". Applied to the code blocks created in `.mdx` files
304264

@@ -341,6 +301,8 @@ const markdownCodeCopyConfig = {
341301
}
342302
```
343303

304+
305+
344306
## Math - LATEX / KATEX
345307

346308
### Exclude Mermaid, Latex, etc. from Shiki syntax highlighting in code blocks

‎package-lock.json‎

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
"rehype-autolink-headings": "^7.1.0",
110110
"rehype-external-links": "^3.0.0",
111111
"remark-breaks": "^4.0.0",
112+
"remark-captions": "^2.2.4",
112113
"remark-custom-blocks": "^2.6.1",
113114
"remark-deflist": "^1.0.0",
114115
"remark-emoji": "^5.0.2",
Lines changed: 7 additions & 0 deletions
Loading

‎public/assets/images/shiprock.svg‎

Lines changed: 9 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)