datopian / flowershow

💐 Publish your obsidian digital garden or any markdown site easily and elegantly.
https://flowershow.app/
MIT License
749 stars 92 forks source link

Added the ability to specify a pre-process function, enabling the inclusion of a custom function for data processing. #577

Closed mohamedsalem401 closed 8 months ago

mohamedsalem401 commented 8 months ago

Pull Request Description

Issue Resolved

Summary

This pull request addresses two specific issues and introduces a valuable enhancement to the Flowershow project. It enables users to add custom functionality before processing files, thus making it more versatile and accommodating for custom plugins or other enhancements.

Details

  1. Custom Pre-Processing Functionality Introduced a pre-processing function, preProcess, which allows users to customize the content before further processing. Here is an example of this function:

    
    export default function preProcess(content) {
     // Replace all occurrences of "=>" with "⟹"
     return content.replace(/=>/g, '⟹');
    }

This enables users to define their own pre-processing logic, such as replacing characters with emojis, adding or removing content, and more.

  1. Issue #519 The introduced changes effectively address Issue #519 by providing a flexible pre-processing step.

  2. Issue #527 These changes also resolve Issue #527.

User Customization

The ability to define custom pre-processing logic empowers users to create unique enhancements to Flowershow, like custom plugins or features that were not possible before. This new capability makes Flowershow even more versatile and user-friendly, allowing for a wide range of content transformations.

vercel[bot] commented 8 months ago

@mohamedsalem401 is attempting to deploy a commit to the Datopian Team on Vercel.

A member of the Team first needs to authorize it.

rufuspollock commented 8 months ago

@mohamedsalem401 thanks for the substantive contribution. We'll take a look!

rufuspollock commented 8 months ago

@mohamedsalem401 my one immediate thought is whether it would be better to do this as a remark plugin ... (they are pretty easy to write and allow this raw regex type stuff) - see e.g. our existing remark plugins here https://github.com/datopian/portaljs/tree/main/packages/remark-callouts

rufuspollock commented 6 months ago

@mohamedsalem401 can we re-open this PR and look at it again. I think it could be a simple way to do some things ...