Skip to content

Commit

Permalink
chore: maybe fix windows bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjennings committed Aug 4, 2023
1 parent b613c75 commit fa08132
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/remark.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export default function (options = {}) {
return function transformer(tree, file) {
let examples = []

const filename = file.filename.split(file.cwd).pop()
const filename = toPOSIX(file.filename).split(toPOSIX(file.cwd)).pop()

// temp to debug windows bug in CI
console.log(file)

visit(tree, 'code', (node) => {
const languages = ['svelte', 'html']
/**
Expand Down Expand Up @@ -156,3 +160,7 @@ function createExampleComponent(value, meta, index) {
<slot slot="code">{@html ${JSON.stringify(highlighted)}}</slot>
</Example>`
}

function toPOSIX(path) {
return path.replace(/\\/g, '/')
}

0 comments on commit fa08132

Please sign in to comment.