Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "Effect-TS/markdown-toc" }],
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [],
"snapshot": {
"useCalculatedVersion": false,
"prereleaseTemplate": "{tag}-{commit}"
}
}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release
on:
push:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
- name: Install node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: 20.9.0
- name: Install dependencies
shell: bash
run: pnpm install --ignore-scripts
- name: Create Release Pull Request or Publish
uses: changesets/action@v1
with:
version: pnpm changeset-version
publish: pnpm changeset-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @effect/markdown-toc

## 0.1.0

### Minor Changes

- [#1](https://github.com/Effect-TS/markdown-toc/pull/1) [`4ecaca8`](https://github.com/Effect-TS/markdown-toc/commit/4ecaca8d93a9dd8311d886f3fb66aa64dd770503) Thanks [@tim-smart](https://github.com/tim-smart)! - initial version
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,20 @@ function generate(options) {

if (tok.lines && (tok.lines[0] > tocstart)) {
var val = tok.content;
const lowerVal = val.toLowerCase();
if (tok.children && tok.children[0].type === 'link_open') {
if (tok.children[1].type === 'text') {
val = tok.children[1].content;
}
}

if (!seen.hasOwnProperty(val)) {
seen[val] = 0;
if (!seen.hasOwnProperty(lowerVal)) {
seen[lowerVal] = 0;
} else {
seen[val]++;
seen[lowerVal]++;
}

tok.seen = opts.num = seen[val];
tok.seen = opts.num = seen[lowerVal];
tok.slug = utils.slugify(val, opts);
res.json.push(utils.pick(tok, ['content', 'slug', 'lvl', 'i', 'seen']));
if (opts.linkify) tok = linkify(tok, opts);
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "markdown-toc",
"name": "@effect/markdown-toc",
"description": "Generate a markdown TOC (table of contents) with Remarkable.",
"version": "1.2.0",
"version": "0.1.0",
"publishConfig": {
"access": "public"
},
"packageManager": "[email protected]",
"homepage": "https://github.com/jonschlinkert/markdown-toc",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
Expand Down Expand Up @@ -44,7 +48,9 @@
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
"test": "mocha",
"changeset-version": "changeset version",
"changeset-publish": "changeset publish"
},
"dependencies": {
"concat-stream": "^1.5.2",
Expand All @@ -61,6 +67,8 @@
"strip-color": "^0.1.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"gulp-format-md": "^2.0.0",
"mocha": "^10.2.0"
},
Expand Down
Loading