Closed ayoubelmhamdi closed 8 months ago
Why don't you ask ChatGPT to do that?
Not every GPT
is powerful, and when we have a complex or lengthy prompt, the GPT
may not follow all instructions correctly, but the programming language (like Rust
) generates text very consistently
My temporary solution is to calculate the dominance between the two situations.
set -e
file="file.md"
left="$(grep -o -e '\\(\(\([^\]*\)[^)]\+\))' -e '\\\[\(\([^\]*\)[^]]\+\)]' "$file" | wc -l)"
dollar="$(grep -o '\$\+\([^$]\+\)\$\+' "$file" | wc -l)"
if [ "$dollar" -gt "$left" ];then
cat book_dollar.toml > book.toml
else
cat book_left.toml > book.toml
fi
Hello @ayoubelmhamdi, was your problem solved?
I do not plan to support multiple different delimiters because 1. it would complicate the code in a way that I do not find worthy and 2. it would encourage people to commit crimes on using many inconsistent delimiters.
However, if you would like to implement this feature, here is where you need to look at:
Hope this helps :D.
thinks @SichangHe.
I think we don't have many delimiters. Is it acceptable to set a fixed number of delimiters that is already supported, so that it automatically handles these default delimiters without requiring the user to specify which delimiter to use?
This approach would eliminate the need for users to think about which delimiter to use.
I did not understand what you mean by "set a fixed number of delimiters that is already supported". Do you mean that we hardcode several delimiter pairs? Also, the default delimiters are dollar signs.
@SichangHe I mean, we should not accept any delimiters from the user. The user should not worry about delimiters because there is a list of supported delimiters.
[preprocessor.katex]
after = ["links"]
block-delimiter = None # not supported anymore
inline-delimiter = None # not supported anymore
mdbook-katex supports only a list of delimiters, like
for the left [ "\\[", "$", "<math>"]
for the right [ "\\]", "$", "</math>"]
If you think there is another delimiter that is very useful, you could add it to the list. What do you think?
Sorry for the delay. I am not a fan of this change because either users will lose some customizability or we will have to deal with all the weird delimiters people use/don't use.
I think for your original problem, it would be much easier to write a script to replace delimiters in your source file to unify all delimiters.
ChatGPT sometimes outputs math formulas as
\[x=2\]
and sometimes as$x=2$
. Is there any way to extend the custom delimiter to be like:test: