Skip to content

Commit

Permalink
fix(lib-option): if files start with a number, remove that in process
Browse files Browse the repository at this point in the history
  • Loading branch information
thorecaspersen committed Jun 13, 2019
1 parent 74415b5 commit 35f8d70
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 157 deletions.
3 changes: 2 additions & 1 deletion demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ option = {
h1: "headline",
blockquote: "quotes"
},
cutSrcLinks: true // <img src="https://octodex.github.com/images/yaktocat.png" /> -> <img src="/images/yaktocat.png" />
cutSrcLinks: true, // <img src="https://octodex.github.com/images/yaktocat.png" /> -> <img src="/images/yaktocat.png" />
numberedFiles: true
};

flotFyrTransformer("./input", "./output", option);
File renamed without changes.
14 changes: 10 additions & 4 deletions lib/flotFyrTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = function(src, dest, markdownOptions) {
headings: false,
remarkPlugins: [],
defualtImport: false,
importer: false
importer: false,
numberedFiles: false
},
markdownOptions
);
Expand Down Expand Up @@ -43,6 +44,11 @@ module.exports = function(src, dest, markdownOptions) {
// get filename without extention ( forxsampel .js)
let filename = path.basename(src, path.extname(src));

// if its a numbered Files, then remove number
if (markdownOptions.numberedFiles) {
filename = filename.split(".")[0];
}

return through(function(chunk, enc, done) {
var output = chunk.toString();

Expand All @@ -53,10 +59,10 @@ module.exports = function(src, dest, markdownOptions) {
},
markdownOptions
);
const jsx = toComponentModule(output, markdownOptions);
const beautifulJsx = prettier.format(jsx, prettierOption);
// const jsx = toComponentModule(output, markdownOptions);
// const beautifulJsx = prettier.format(jsx, prettierOption);

done(null, beautifulJsx);
done(null, output);
});
}
};
Expand Down
114 changes: 114 additions & 0 deletions output/1.testmarkdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: Everything is ok
quantity: 834
prependJs:
- "const Timer = require('./timer')"
- "import { Watcher } from './watcher'"
---
# An h1 header

{{ <headline /> }}
Paragraphs are separated by a blank line.

2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists
look like:

* this one
* that one

> Block quotes are
> written like so.

## An h2 header

Here's a numbered list:

1. first item
2. second item
3. third item

Note again how the actual text starts at 4 columns in (4 characters
from the left side). Here's a code sample:

# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }

As you probably guessed, indented 4 spaces. By the way, instead of {{ <LetsDoThis /> }}
indenting the block, you can use delimited blocks, if you like:

~~~
define foobar() {
print "Welcome to flavor country!";
}
~~~

![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)

{{ <FancyReactComponent /> }}
(which makes copying & pasting easier). You can optionally mark the
delimited block for Pandoc to syntax highlight it:

~~~python
import time
# Quick, count to ten!
for i in range(10):
# (but not *too* quick)
time.sleep(0.5)
print i
~~~

```bash
$ cd dillinger
$ npm install -d
$ node app
```



### An h3 header

Now a nested list:

1. First, get these ingredients:

* carrots
* celery
* lentils

2. Boil some water.

3. Dump everything in the pot and follow
this algorithm:

find wooden spoon
uncover pot
stir
cover pot
balance wooden spoon precariously on pot handle
wait 10 minutes
goto first step (or shut off burner when done)

Here's a link to [a website](http://foo.bar), to a [local
doc](local-doc.html), and to a [section heading in the current
doc](#an-h2-header). Here's a footnote [^1].

[^1]: Footnote text goes here.


<details>
<summary>Spoiler text</summary>
whatever
</details>

First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell

named links to [Google](http://google.com/)
<http://fest.com/>



# React test
{{ <FancyReactComponent /> }}
152 changes: 0 additions & 152 deletions output/testmarkdown.js

This file was deleted.

0 comments on commit 35f8d70

Please sign in to comment.