Closed sgoggins closed 2 months ago
@boyter : I tried to get this to catch the .mdx files in a repository by making these changes. I perhaps did not compile correctly? go build
? Or, other files need to be changed. The syntax for these .mdx files does look like markdown.
This fixes issue #439
Out of morbid curiosity as a newcomer to go, I'm curious why go build
doesn't make the changes work. This series of steps, which I'm sure a real GO programmer would know, worked for me. FWIW:
go mod tidy
go generate ./...
go build -a
./scc -l #a test
Its the go generate
part that does it. It actually triggers this https://github.com/boyter/scc/blob/master/main.go#L14C1-L14C40 which in turn calls https://github.com/boyter/scc/blob/master/scripts/include.go which does some validation and produces embedded content.
Its common practice in Go to generate code since dynamic stuff can be a pain.
It is possible to do this via a build these days using embed however it wouldn't do the pre-checks to ensure the JSON is valid, although would be picked up later on. Mostly this is a result of being created before embed was included into Go.
I actually use the https://github.com/boyter/scc/blob/master/test-all.sh script which does it for me as well as running all tests, but this step is also included in the README https://github.com/boyter/scc/tree/master?tab=readme-ov-file#development
I believe mdx files will be supported by adding the extension to the markdown block. The syntax is markdown.