Comments (2)
https://github.com/rehypejs/rehype-autolink-headings
from velite.
Okay so i managed to add ids using the prepare function with below code in velite config, in case someone needs it, its here. but it would have been nice if library provides it or I missed something?
blogs.forEach((blog) => {
const pattern = /n\(\w\.h[1-7],{[^}]+}\)/g
let match
while ((match = pattern.exec(blog.content)) !== null) {
const matchedText = match[0]
const childrenMatch = matchedText.match(/children:"([^"]+)"/)
if (childrenMatch) {
const childrenText = childrenMatch[1]
const slugifiedChildren = slugify(childrenText)
const modifiedText = matchedText.replace(
/(children:")([^"]+)(")/,
`$1$2$3,id:"${slugifiedChildren}"`
)
blog.content = blog.content.replace(matchedText, modifiedText)
}
}
})
from velite.
Related Issues (20)
- Unhandled Runtime Error When using remarkCodeHike HOT 4
- Weird Page Freeze when Navigating via Table of Contents Links HOT 1
- Is it possible to use files stored inside github repo? HOT 4
- [feature request] handle contents failing schema validation, or autofixing HOT 8
- Handling relationships HOT 4
- TOC breaking change/broken on latest release HOT 3
- The provided config in #37 resolves warning in dev mode but still present in deployment HOT 1
- Webpack cache warning HOT 2
- Property does not exist on type '{ props: { readonly components?: {} | undefined; }; }' .ts-plugin(2339) HOT 1
- `prepare`, `complete` events access to configuration `output` object HOT 3
- Taxonomy example dev server stops suddenly without error message HOT 1
- Property 'description', 'title', does not exist on type '{ slug: string; } & { slugAsParams: string; }'.ts(2339) HOT 3
- Support for additional metadata in mdx files HOT 2
- Unknown file extension ".css" HOT 9
- Support files with multiple documents (jsonc, yaml) HOT 4
- Schema table of contents cannot read more than 5 headings HOT 1
- Documentation improvement HOT 1
- Bundle MDX example causes "TypeError: Cannot read properties of undefined (reading 'path')" HOT 3
- A Collection defined with `defineCollection` causes a type error when included in `defineConfig`'s `collections`.
- [Feature Request] s.excerpt({ separator: 'preview' }) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from velite.