mirror of
https://github.com/plankanban/planka.git
synced 2025-12-25 09:15:00 +03:00
fix: Handle markdown-to-text errors gracefully
This commit is contained in:
@@ -8,10 +8,15 @@ import transform from '@diplodoc/transform';
|
||||
import plugins from '../configs/markdown-plugins';
|
||||
|
||||
export default (markdown) => {
|
||||
const tokens = transform(markdown, {
|
||||
plugins,
|
||||
tokens: true,
|
||||
});
|
||||
let tokens;
|
||||
try {
|
||||
tokens = transform(markdown, {
|
||||
plugins,
|
||||
tokens: true,
|
||||
});
|
||||
} catch (error) {
|
||||
return error.toString();
|
||||
}
|
||||
|
||||
return tokens
|
||||
.flatMap((token) => {
|
||||
|
||||
Reference in New Issue
Block a user