Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Nov 20, 2024
1 parent eb3917f commit 01b8b2a
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 125 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
with:
fetch-depth: 0

- run: zip -r Hugo.zip Hugo -x "*.DS_Store"
- run: zip -r MDX.zip MDX -x "*.DS_Store"

- name: Upload style to release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Hugo.zip
file: MDX.zip

test:
runs-on: ubuntu-latest
Expand All @@ -37,10 +37,10 @@ jobs:
mkdir bin && tar -xvzf vale_${VALE_VERSION}_Linux_64-bit.tar.gz -C bin
echo "./bin" >> $GITHUB_PATH
env:
VALE_VERSION: 3.3.0
VALE_VERSION: 3.9.1

- name: Features
run: |
zip -r Hugo.zip Hugo -x "*.DS_Store"
zip -r MDX.zip MDX -x "*.DS_Store"
cd testdata && ../bin/vale sync && cd -
go test -v ./...
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hugo.zip
MDX.zip
/testdata/styles

# Binaries for programs and plugins
Expand Down
10 changes: 0 additions & 10 deletions Hugo/.vale.ini

This file was deleted.

21 changes: 21 additions & 0 deletions MDX/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[formats]
mdx = md

[*.mdx]
CommentDelimiters = {/*, */}

# Exclude:
#
# `import ...`, `export ...`
# `<Component ... />`
# `<Component>...</Component>`
# `{ ... }`
TokenIgnores = (?sm)((?:import|export) .+?$), \
(<[A-Z]+ ?.+ ?\/>), \
(<[A-Z]\w+>.+?<\/[A-Z]\w+>)

# Exclude:
#
# `<Component \n ... />`
BlockIgnores = (?sm)^(<\w+\n .*\s\/>)$, \
(?sm)^({.+\n.*})
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
all: test

zip:
zip -r Hugo.zip Hugo -x "*.DS_Store"
zip -r MDX.zip MDX -x "*.DS_Store"

sync:
cd testdata && vale sync && cd -
cd testdata && vale sync && vale transform test.mdx > test.md && cd -

test: zip sync
go test -v ./...
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Hugo
# MDX

A Vale configuration for Hugo-generated static sites.
A Vale configuration for sites using [MDX][1].

## Testing

```
$ make test
```

[1]: https://mdxjs.com
4 changes: 2 additions & 2 deletions testdata/.vale.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
StylesPath = styles

Packages = ../Hugo.zip
Packages = ../MDX.zip

[*.md]
[*.mdx]
BasedOnStyles = Vale
81 changes: 0 additions & 81 deletions testdata/shortcodes.md

This file was deleted.

22 changes: 0 additions & 22 deletions testdata/test.ct

This file was deleted.

56 changes: 56 additions & 0 deletions testdata/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Hello, world!

`import {External} from './some/place.js'`
`import {Chart} from './chart.js'`
`import population from './population.js'`

`export const pi = 3.14`
`export const Local = properties => <span style={{color: 'red'}} {...properties} />`

`<Chart data={population} label={'Something with ' + pi} />`

An `<External>external</External>` component and a `<Local>local one</Local>`.

<div className="note">
> Some notable things in a block quote!
</div>
`<Welcome name="Venus" />`
`<Welcome name="Mars" />`

`<MyComponent id="123" />`

You can also use objects with components, such as the `thisOne` component on
the `myComponents` object: <myComponents.thisOne />


```
<Component
open
x={1}
label={'this is a string, *not* markdown!'}
icon={`<Icon />`}
/>
```


Two 🍰 is: {Math.PI * 2}


```
{(function () {
const guess = Math.random()
if (guess > 0.66) {
return <span style={{color: 'tomato'}}>Look at us.</span>
}
if (guess > 0.33) {
return <span style={{color: 'violet'}}>Who would have guessed?!</span>
}
return <span style={{color: 'goldenrod'}}>Not me.</span>
})()}
```


47 changes: 47 additions & 0 deletions testdata/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Hello, world!

import {External} from './some/place.js'
import {Chart} from './chart.js'
import population from './population.js'

export const pi = 3.14
export const Local = properties => <span style={{color: 'red'}} {...properties} />

<Chart data={population} label={'Something with ' + pi} />

An <External>external</External> component and a <Local>local one</Local>.

<div className="note">
> Some notable things in a block quote!
</div>
<Welcome name="Venus" />
<Welcome name="Mars" />

<MyComponent id="123" />

You can also use objects with components, such as the `thisOne` component on
the `myComponents` object: <myComponents.thisOne />

<Component
open
x={1}
label={'this is a string, *not* markdown!'}
icon={<Icon />}
/>

Two 🍰 is: {Math.PI * 2}

{(function () {
const guess = Math.random()

if (guess > 0.66) {
return <span style={{color: 'tomato'}}>Look at us.</span>
}

if (guess > 0.33) {
return <span style={{color: 'violet'}}>Who would have guessed?!</span>
}

return <span style={{color: 'goldenrod'}}>Not me.</span>
})()}

0 comments on commit 01b8b2a

Please sign in to comment.