Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more options to playground, directives, format, etc #2295

Merged
merged 15 commits into from
Jun 10, 2023
Merged
Prev Previous commit
move removePositionEsast at the bottom of the file
  • Loading branch information
slorber committed Jun 9, 2023
commit cc12b73dc17916b63ac3adfe6b9e0bbc779dadec
24 changes: 12 additions & 12 deletions docs/_component/editor.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ lowlight.registerLanguage('js', javascript)
lowlight.registerLanguage('json', json)
lowlight.registerLanguage('md', markdown)

function removePositionEsast(tree) {
visitEstree(tree, remove)
return tree

function remove(node) {
delete node.loc
delete node.start
delete node.end
delete node.range
}
}

function useMdx(defaults) {
const [state, setState] = useState({...defaults, file: null})
const {run: setConfig} = useDebounceFn(
Expand Down Expand Up @@ -416,3 +404,15 @@ export function Editor({children}) {
</div>
)
}

function removePositionEsast(tree) {
visitEstree(tree, remove)
return tree

function remove(node) {
delete node.loc
delete node.start
delete node.end
delete node.range
}
}