Skip to content

Commit

Permalink
fix: remove hardcoded heading2 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tefkah committed Jun 29, 2024
1 parent 1a67412 commit 1ac1155
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions libs/book-converter/src/lib/paragraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,43 +64,7 @@ export const makeParagraphHandlers = (
{
matcher: 'Heading1',
handler: (h, node) => {
return [
PB,
m(
'chapter',
all(h, node).map((n) => {
if (n.type !== 'string') {
return n
}

const result = { ...n, content: n.content.replace(/(?:chapter|hoofdstuk) \d+: /gi, '') }

return result
}),
),
PB,
]
},
},
{
matcher: 'Heading2',
handler: (h, node) => {
return [
PB,
m(
'section',
all(h, node).map((n) => {
if (n.type !== 'string') {
return n
}

const result = { ...n, content: n.content.replace(/^\d+\.\d+\s?/g, '') }

return result
}),
),
PB,
]
return [PB, m('chapter', ...all(h, node)), PB]
},
},
{
Expand Down

0 comments on commit 1ac1155

Please sign in to comment.