In the last few weeks i did some more work on my blog parser [1]. If you like to try out new software, there might be something in there for you.
The parser is structured in preprocessor modules and a central blog processor.
parse_blog.c
gmi_tools.c gmi_tools.h
highlighter.c highlighter.h
math_parse.c math_parse.h
references.c references.h
table_parse.c table_parse.h
rss.c rss.h
vec.c vec.h
Most of the preprocessor modules can easily be used in other programs with
the functions defined in their header files.
The repository includes the bash script docs.sh
to read the provided documentation
of each module
$ ./docs.sh highlighter
# highlighter
--
Depends on the C standard library and the vec library
--
## highlight_code_blocks_in_markdown_string()
Highlights the code blocks wrapper in
```{language_name} ... ```
blocks in a markdown string.
The output is markdown with html blocks.
The function crashes, if no highlighter config
is found for {language_name}.
The configs are expected in a directory called
`highlighter_configs/` with filename
`{language_name}.conf`.
Some examples are provided with the blog_parser
repository.
The highlighter uses the CSS classes `keyword`,
`type` and `comment`. Be sure to style those
classes if you want highlighting.
Call:
char* highlight_code_blocks_in_markdown_string(char*);
If you want to use the highlighter
module in your python script
for example, you simply write a wrapper program like this.
#include "highlighter.h"
int main() {
// ... read from stdin or some file
char* out = highlight_code_blocks_in_markdown_string(input);
print(out);
free(out);
}
I will add more documentation and example in the tests/
directory of
the repository when i find the time.
There is nothing new or ground breaking in there, but maybe it can be
a fun time still.
[1] blog_parser
This site uses the wonderful Catppuccin color scheme.
My RSS Feed.
Mail: mia.schambeck@mailbox.org
XMPP: mia.schambeck@mailbox.org
Bluesky: @miajara.bsky.social
Mastodon: @miasb.sueden.social