lukas-reineke / cbfmt Goto Github PK
View Code? Open in Web Editor NEWA tool to format codeblocks inside markdown and org documents.
License: MIT License
A tool to format codeblocks inside markdown and org documents.
License: MIT License
Thanks for this small nifty tool.
I was wondering how exactly one can use config files for the specific formatters? For example with stylua.
I runcbfmt
as cbfmt --config "$some_path"
. The specified cbfmt.toml
is correctly recognized, since adding / removing lua
does make a difference. However, I cannot figure out how to make cbfmt make stylua use a config file.
I have a stylua.toml
in the same directory as the cbfmt.toml
, and also in the nvim-pwd when executting the formatting command (via null-ls). However, cbfmt-run-stylua does not seem to recognize it since it seems to run on default config.
my config example
[languages]
lua = ["stylua --search-parent-directories -"]
I mean, I could explicitly run add a --config
to the cbfmt.toml
, but that would be really cumbersome.
it would be nice to support LaTeX $$
blocks as a special case:
$$
\alpha \beta \gamma
$$
uncrustify is a formatter for c/cpp write by rust
.cbfmt.toml
[languages]
rust = ["rustfmt"]
c= ["uncrustify -q -l C --no-backup"]
md.md
# Test ```c int main () { int = 2; int b = 3; } ```
❯ cbfmt md.md
[Fail]: md.md
[0/1] files are formatted correctly.
file Fail to formatted
but uncrustify
work from command line
$ uncrustify -q -l C --no-backup md.md
cat md.md
cat md.md
#Test ` ` ` c int main() { int = 2; int b = 3; } ` ` `
Any chance cbfmt
could work with .norg
files from Neorg
in the future?
There's also nvim-neorg/tree-sitter-norg.
Thanks.
The musl build in the releases is not statically built, it seems to be the same as the linux build.
I think the --target=x86_64-unknown-linux-musl
option is needed for cargo build
.
I'm trying to have cbfmt
autoformat my C code blocks using clang-format
with the following config:
[languages]
c = ["clang-format -style=\"{BasedOnStyle: Google, IndentWidth: 4, UseTab: Never, TabWidth: 4}\""]
However, it seems to split args on spaces without respecting the escaped quote. clang-format
thinks that it has received 6 filenames which yields the error:
$ cbfmt -w test.md
[Error]: test.md:3 [c] -> [clang-format]
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
No such file or directory
[0/1] files were written.
Here's my test markdown file:
Hello
```c
struct MailStructure {
unsigned int data : 18; // Assuming data is 18 bits
unsigned int reserved : 10;
unsigned int channel : 4;
};
```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.