Closed vweevers closed 6 years ago
Added levelup compatibility badges to the bundles. This is specified in the JSON as:
And jsondown
now uses that same generic mechanism:
The following files are now generic enough to be moved to their own npm packages:
But I prefer to first merge this PR and pull in more modules from the wiki (#1, which is much easier now) to see if there are any gaps in the tooling.
@ralphtheninja WDYT?
Also, would you mind testing npm run awesome
to avoid "works on my machine"? You can manually remove one of the tables from README before npm run awesome
to see that it regenerates.
Also, would you mind testing npm run awesome to avoid "works on my machine"? You can manually remove one of the tables from README before npm run awesome to see that it regenerates.
Tried removing the first table but seems links are broken since no back ticks are inserted:
diff --git a/README.md b/README.md
index 066d7bb..3aff8b6 100644
--- a/README.md
+++ b/README.md
@@ -20,14 +20,14 @@
## Bundles
-Convenience modules that bundle [a store](#stores) with [`levelup`] and [`encoding-down`].
+Convenience modules that bundle [a store](#stores) with [levelup] and [encoding-down].
Name | Compatibility | Dependencies | Description
:--- | :------------ | :----------- | :----------
-**[`level`]** | ![levelup](https://img.shields.io/badge/levelup-2.0-brightgreen.svg) | [![dependencies](https://img.shields.io/david/level/level.svg?label=%E2%99%A5)](https://david-dm.org/level/level) | Bundle for [`leveldown`].<br>Main entry point for beginners.
-**[`level-mem`]** | ![levelup](https://img.shields.io/badge/levelup-2.0-brightgreen.svg) | [![dependencies](https://img.shields.io/david/level/level-mem.svg?label=%E2%99%A5)](https://david-dm.org/level/level-mem) | Bundle for [`memdown`].
-**[`level-rocksdb`]** | ![levelup](https://img.shields.io/badge/levelup-2.0-brightgreen.svg) | [![dependencies](https://img.shields.io/david/level/level-rocksdb.svg?label=%E2%99%A5)](https://david-dm.org/level/level-rocksdb) | Bundle for [`rocksdb`].
-**[`level-browserify`]** | ![levelup](https://img.shields.io/badge/levelup-1.3-orange.svg) | [![dependencies](https://img.shields.io/david/level/level-browserify.svg?label=%E2%99%A5)](https://david-dm.org/level/level-browserify) | Bundle for [`level-js`].
+**[`level`]** | ![levelup](https://img.shields.io/badge/levelup-2.0-brightgreen.svg) | [![dependencies](https://img.shields.io/david/level/level.svg?label=%E2%99%A5)](https://david-dm.org/level/level) | Bundle for [leveldown].<br>Main entry point for beginners.
+**[`level-mem`]** | ![levelup](https://img.shields.io/badge/levelup-2.0-brightgreen.svg) | [![dependencies](https://img.shields.io/david/level/level-mem.svg?label=%E2%99%A5)](https://david-dm.org/level/level-mem) | Bundle for [memdown].
+**[`level-rocksdb`]** | ![levelup](https://img.shields.io/badge/levelup-2.0-brightgreen.svg) | [![dependencies](https://img.shields.io/david/level/level-rocksdb.svg?label=%E2%99%A5)](https://david-dm.org/level/level-rocksdb) | Bundle for [rocksdb].
+**[`level-browserify`]** | ![levelup](https://img.shields.io/badge/levelup-1.3-orange.svg) | [![dependencies](https://img.shields.io/david/level/level-browserify.svg?label=%E2%99%A5)](https://david-dm.org/level/level-browserify) | Bundle for [level-js].
Also, db.open()
looks slightly odd:
Maybe write Click to expand
or something.
Also, db.open() looks slightly odd:
I did not mean to keep that haha. Will fix.
Tried removing the first table but seems links are broken since no back ticks are inserted:
I'll see if I can replicate.
@ralphtheninja which node version are you on?
@ralphtheninja which node version are you on?
node 10
@vweevers I can switch to another version just to see if that's the problem. Which one are you on?
I just tried node 10, works for me. I was on node 8.6.0. Can you try it with the latest commit (https://github.com/Level/awesome/pull/11/commits/1bc21d477812311eaf885cdedf08a62482897ad9)?
Found the issue, I think. I'm using the wrong node type for the link content. Instead of text
I should use inlineCode
.
Still have the same issues. I get the same error when running npm run awesome
even without removing the first table. Also, if I remove the Core
table it doesn't re-generate.
:(
It's weird that you can't reproduce it :open_mouth:
If I only do npm run awesome
(without changing anything). I get the following output:
$ npm run awesome
> level-awesome@0.0.1 awesome /home/lms/src/level/awesome
> node src README.md modules/*
README.md
1:12-1:23 warning dead reference: leveldown remark-bookmarks
1:12-1:21 warning dead reference: memdown remark-bookmarks
1:12-1:21 warning dead reference: rocksdb remark-bookmarks
1:12-1:22 warning dead reference: level-js remark-bookmarks
1:57-1:66 warning dead reference: levelup remark-bookmarks
1:71-1:86 warning dead reference: encoding-down remark-bookmarks
⚠ 6 warnings
Can you apply the following patch and send me the output?
diff --git a/src/index.js b/src/index.js
index bbab71a..073c195 100644
--- a/src/index.js
+++ b/src/index.js
@@ -23,8 +23,20 @@ remark()
summary: () => 'Click to expand'
})
.use(github)
+
+ .use(() => (tree) => {
+ console.log('BEFORE')
+ console.log(JSON.stringify(tree, null, 2))
+ })
+
.use(bookmarks, { modules })
+ .use(() => (tree) => {
+ console.log('AFTER')
+ console.log(JSON.stringify(tree, null, 2))
+ process.exit()
+ })
+
// Disable padding to lessen diff noise
.use(stringify, { paddedTable: false, looseTable: true })
The difference is this:
{
"vince-before": {
"identifier": "riakdown",
"referenceType": "shortcut",
"type": "linkReference",
"children": [
[{
"type": "inlineCode",
"value": "riakdown"
}]
]
},
"magnus-before": {
"identifier": "`riakdown`",
"referenceType": "shortcut",
"type": "linkReference",
"children": [{
"type": "inlineCode",
"value": "riakdown",
"position": ..
}],
"position": ..
}
}
The presence of position
on the nodes suggests that these are the parsed nodes of the original markdown, rather than newly generated nodes. Which means src/remark-generator.js
doesn't do anything in your case.
And I found out why :) Your shell expands the glob pattern in node src README.md modules/*
which is incompatible with:
https://github.com/Level/awesome/blob/491c7b52d5fd9ca931271dd7602149aa186eeb0d/src/index.js#L15
That's my bad. Fix coming in a bit.
Fixed. There's one final thing I want to do: the bookmarks plugins should behave the same on parsed nodes and generated nodes. I.e. if you do node src README.md modules/core.json
it should leave the other sections intact.
@vweevers Works fine now!
I.e. if you do node src README.md modules/core.json it should leave the other sections intact.
Done.
@vweevers Maybe we could have a similar approach to documentation for e.g. leveldown
, levelup
, level
, level-mem
, level-rocksdb
etc.
@ralphtheninja yeah, def. I was thinking we could create a preset (see https://github.com/unifiedjs/unified#example-1) with a bunch of remark plugins, and use it everywhere.
@ralphtheninja yeah, def. I was thinking we could create a preset (see https://github.com/unifiedjs/unified#example-1) with a bunch of remark plugins, and use it everywhere.
Feel free to create some issues on it and break it down. Maybe it's even possible to use across the board? I'm thinking mainly on keeping the same "level style" in all READMEs.
@vweevers Side note; What's the "next step" for level? I'm thinking we should try to push through the latest abstract-leveldown
into dependents to make this readme a little more green.
Maybe we can also use the level badge in related projects?
I'm thinking we should try to push through the latest abstract-leveldown into dependents to make this readme a little more green.
Yes, starting with level-js
. That's been waiting too long
(Airtap work can wait, no?)
(Airtap work can wait, no?)
I feel airtap works rather well right now.
Maybe we can also use the level badge in related projects?
What do you mean?
Sort of like the awesome badge. There are many awesome projects scattered across github, but they all (or most of them) use the awesome badge. If that makes sense.
You mean adding the badge to projects like subleveldown (outside the level org)? Sure :)
Took more code than I thought, and I want to move some stuff out. But it works :)
This moves the modules to JSON files as the source of truth and adds
npm run awesome
to:remark-toc
)remark-github
)removewarn about dead references.