#48 : Add customized h1, h2
This commit is contained in:
19
src/docs/utils/string.js
Normal file
19
src/docs/utils/string.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export const parseProps = (propsStr) => {
|
||||
const props = propsStr?.split(';').filter(Boolean) || []
|
||||
return props.reduce((acc, cur) => {
|
||||
const prop = cur.split(':')
|
||||
return {
|
||||
...acc,
|
||||
[prop[0]]: prop[1]
|
||||
}
|
||||
}, {})
|
||||
}
|
||||
|
||||
export const parseTitleStr = (titleStr) => {
|
||||
const parts = titleStr.split('!')
|
||||
|
||||
return {
|
||||
title: parts[0],
|
||||
props: parseProps(parts[1])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user