-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract headings to db #83
Comments
@superiums great suggestion. Do you have a specific structure you want e.g. do you want line numbers etc? |
linenumber usually is not the first concern, eg: # medicine Axxx
> this is for catch cold.
this medicine contains following element:
- element A
- element B
- element xxx
## description: 3times per day.
other text xxxxxxxxxxxxxxx
# medicine Bxxx
> this is for catch hot.
this medicine contains following element:
- element yyy
- element uuu
- element xxx
## description: not eat meat.
other text oooooooooooooooooooooooooooooooooo
yet an other text oooooooooooooooooooooooooooo
... the document could be serialized to sqlite via folling fields:
which filed to serialize could be customized by cmd arguments. |
this is effeciency if user need to search sth in specifec place.
or sth else, for common usage, all specific markd md is able to act like this. main contains:
|
i rethink it more, i found only maybe like this: the discription is the qutoe line wich following the heading line. |
@superiums For example, the following: function getFirstHeading(fileObject: any, ast: any){
let firstHeading: any = null;
// Use unist-util-visit to traverse the AST and find the first heading
visit(ast, 'heading', (node: HeadingNode) => {
if (!firstHeading) {
firstHeading = node;
}
// Stop visiting after finding the first heading
return visit.EXIT;
});
// Assign the header property to the founded header
fileObject.header = firstHeading;
}
client.indexFolder("PATH", {computedFields: [getFirstHeading]}) You can add additional fields (or functions) to compute the first nth headings and the first nth descriptions as needed... |
@mohamedsalem401 this would be perfect for a small blogpost. |
how about to extract headings (marked as
#
, ...######
) to db ?heading is the main structor of a markdown file.
this helps structer the file and make local knowedege db avaluable.
The text was updated successfully, but these errors were encountered: