Comments (5)
Hmm.
With the following file test.pandoc
- [] a
When I pipe it to the command that Neoformat
is supposed to run, like follows:
cat test.pandoc | pandoc -f markdown+abbreviations+autolink_bare_uris+markdown_attribute+mmd_header_identifiers+mmd_link_attributes+mmd_title_block+tex_math_double_backslash+emoji -t markdown+raw_tex-native_spans-simple_tables-multiline_tables+emoji --normalize -s --wrap=auto --atx-headers | sed -e 's/\[/[/g' -e 's/\]/]/g'
I get the following output
- \[\] a
And when I pipe the output to sed
it also doesn't work.
echo "- \[\] a" | sed -e 's/\[/[/g' -e 's/\]/]/g'
produces
- \[\] a
Edit: actually, I think sed is fine, but vim is escaping it weird.
sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'
// goes to
sed -e 's/\[/[/g' -e 's/\]/]/g'
Will investigate further.
from neoformat.
I think the number of backslashes in the regex may be the issue, but I can't see why that'd break now all of a sudden.
from neoformat.
I think vim might be messing with the sed
regex when it is used with system()
Some outputs to ponder
" 1. Pipe data to pandoc, which pipes to sed
let stdin = '- [] a'
let cmd = 'pandoc -f markdown -t markdown --normalize -s --wrap=auto --atx-headers'
let sed = "sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'"
let exe = cmd . ' | ' . sed
let stdout = systemlist(exe, stdin)
echom string(stdout)
" ['- \[\] a']
" 2. Pass data to sed via stdin
let stdin = '- \[\] a'
let sed = "sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'"
let stdout = systemlist(sed, stdin)
echom string(stdout)
" ['- \[\] a']
" 3. Echo data in shell to sed
let cmd = "echo '- \[\] a'"
let sed = "sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'"
let exe = cmd . ' | ' . sed
let stdout = systemlist(exe)
echom string(stdout)
" ['- [] a']
from neoformat.
Try out the latest version.
It's not pretty, but I think I fixed it.
from neoformat.
That looks awful, but it does work.
from neoformat.
Related Issues (20)
- `.swiftformat` config not detected
- clang-format used when formatter fails in some filetypes
- [Solved] fprettify makes nvim buffer empty HOT 1
- C# clang-format with Microsoft style broken HOT 1
- truncating files HOT 1
- Pyi files
- Clang-format doesn't use the style config file closest to the file's location
- Formatting F# buffer replaces it with error message
- g:neoformat_only_msg_on_error not working correctly
- Topiary support HOT 1
- Monorepo project root determination
- Adding `eslint_d` as valid formatter for another filetype, like "Vue" HOT 3
- .clang-format file is ignored when style is specified to file
- Configuration on neovim use lua HOT 1
- Add dprint as a formatter HOT 2
- Add ruff formatter for Python HOT 3
- Format only changed lines
- clang-format not work
- Please start tagging releases or remove the old tags
- formatters prettierd, eslint_d failed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neoformat.