Comments (7)
No worries, thanks for checking it and reporting back!
I honestly wasn't aware of the Powershell encoding quirk either, so I'm glad you reported the strangeness. I'll get the docs updated so people don't have the same issue in the future
from gomarkdoc.
This happens when I show the file with cat:
from gomarkdoc.
Thanks for the report! I found the file in the repo (linking here so i can quickly refer back): https://github.com/pterm/pterm/blob/9d43bad55166341b6349c3c93cc2e764051d9de6/bigtext_printer.go#L135
I'm betting it's an issue with the escaping logic. Let me work up a test case to see if I can find the problem here
from gomarkdoc.
I created some tests but they appear to be producing the output correctly. I tried cloning pterm and running gomarkdoc .
on it. The output seems to be correct to me: https://gist.github.com/princjef/ba9265239132c477e438cabd55431186
Can you share some more information about how you're configuring/running gomarkdoc? That might help us get to the bottom of this.
from gomarkdoc.
Hi @princjef, thanks for the reply. I just tried it again, with a new clone of PTerm and I still get the wrong characters when I run gomarkdoc . > test.md
.
I don't have any custom configuration.
IntelliJ IDEA tells me, that the output file is written in UTF-16LE
encoding. I think, this might be the problem? I am using Windows 10 with PowerShell.
from gomarkdoc.
@MarvinJWendt ahh okay I think Powershell is the key detail here. I don't have a Windows machine handy to test, but it looks like when piping output, Powershell defaults the encoding to UTF16: https://automationpie.com/changing-powershells-default-output-encoding-to-utf-8/
From what I'm seeing, it doesn't look like there's any way for me to signal the encoding from the gomarkdoc
executable itself to override that behavior. I think there are two options:
- Change the encoding in your Powershell settings as described in the linked page so that data is passed in UTF-8 encoding.
- Use the
--output
option so thatgomarkdoc
bypasses Powershell's piping and writes the file directly. This should provide the right encoding for your output file:gomarkdoc --output test.md .
I'd be curious to see if option 2 works for you. If it does, then it may make sense to update the examples to use --output
so that people get more consistent cross-platform behavior out of the box.
from gomarkdoc.
Hi @princjef, sorry for the late reply. Yes the output flag seems to work!
And the pipe seems to be the problem. Even as a long time Windows user I never experienced this.
I wrote a sample file, with the chars that where producing the weird behaviour, and piped it into another file. And look at that, the error occurs. So it might be the best to update the example :)
Have a nice day and thanks for the research :)
from gomarkdoc.
Related Issues (20)
- Pre-commit support HOT 1
- String manipulation functions in template
- Potential incorrect Markdown link syntax HOT 4
- [Bug] Check mode always returns with zero exit code when embed mode is also enabled HOT 1
- Is there a way to omit certain functions? HOT 2
- Pandoc Markdown Support
- Relative link
- Multiple newlines are generated during templates processing
- Bug in generating markdown files with characters *(){}[]- HOT 1
- Ability to choose codeblock language HOT 2
- Generate wrong index for go 1.18 generic code HOT 6
- support new godoc spec enforced by gofmt HOT 3
- Links in comments aren't generated correctly HOT 1
- git branch issue when running in ci environment HOT 2
- new headings syntax in go 1.19 HOT 1
- Is there a way to generate docs for all packages in a project HOT 1
- Ignoring appending into generated docs when using -e flag HOT 2
- add support for Template functions HOT 3
- Ignore vendor folder HOT 4
- Links appear broken in README files HOT 2
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 gomarkdoc.