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

Allow link to other pages in table entry #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MihaiAnca13
Copy link

I added a bit of code that checks and re-maps the properties of an entry if the title is actually a link to another page. I'm sure you can find a better way to access the 'title' and 'uri', but I have very basic knowledge of javascript and could only make it work. I hope this would help others as well! Please let me know if you need me to explain anything.

@MihaiAnca13
Copy link
Author

I've just tested this some more and it doesn't work with caching, unfortunately. Other than that, it seems fine!

@JanakyMurthy
Copy link

@MihaiAnca13 I would like to try this fix locally on my system. Could you tell where one would typically expect to find the notablog source files? I installed notablog via npm i -g notablog and cloned the notablog-starter repo.

@MihaiAnca13
Copy link
Author

Hi @JanakyMurthy.

If you are using Linux: when you install notablog globally using npm, it creates a symlink in /usr/local/bin/notablog. If you use ls -l /usr/local/bin/notablog you can see where that symlink points to. I personally cloned the notablog repo and redirected that symlink to where I've placed it. In case you can't find it there, you can just use which notablog and it should point you to the right folder.

If you are using windows, please have a look here.

Let me know if you need more help.

@JanakyMurthy
Copy link

JanakyMurthy commented Jul 28, 2021

Hi @JanakyMurthy.

If you are using Linux: when you install notablog globally using npm, it creates a symlink in /usr/local/bin/notablog. If you use ls -l /usr/local/bin/notablog you can see where that symlink points to. I personally cloned the notablog repo and redirected that symlink to where I've placed it. In case you can't find it there, you can just use which notablog and it should point you to the right folder.

If you are using windows, please have a look here.

Let me know if you need more help.

@MihaiAnca13 Thanks, I was able to find where the notablog repo was. However I was not able to find a src directory there.

$ls 
LICENSE		assets		dist		package.json
README.md	bin		node_modules

I am assuming npm install does not copy the source files. Suppose I copy the src directory and try your fix - how do I compile those changes so that it is used when I use notablog generate . next time? Sorry for this basic question but I am not familiar with node js. Thanks :)

@MihaiAnca13
Copy link
Author

@JanakyMurthy
Ah, that must be why I've cloned the repo myself.

Here's how I did it:

  1. clone this repo
  2. go to where notablog symlink currently is. you can find it with which notablog. for me this was /usr/local/bin/notablog
  3. recreate the symlink to where you cloned the repo. here's an example:
    ln -sf /location_of_repo/notablog/bin/cli.js /usr/local/bin/notablog

Now, if you run notablog in your terminal, it should point to the repo and use the src files you have there without any need to recompile.

@JanakyMurthy
Copy link

@JanakyMurthy
Ah, that must be why I've cloned the repo myself.

Here's how I did it:

1. clone this repo

2. go to where notablog symlink currently is. you can find it with `which notablog`. for me this was `/usr/local/bin/notablog`

3. recreate the symlink to where you cloned the repo. here's an example:
   `ln -sf /location_of_repo/notablog/bin/cli.js /usr/local/bin/notablog`

Now, if you run notablog in your terminal, it should point to the repo and use the src files you have there without any need to recompile.

@MihaiAnca13 , thank you. I got the symlinks updated. But notablog --help throws up this error

jana:notablog-starter janakymurthy$ notablog --help
internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module '@dnpr/cli'
Require stack:
- /Users/janakymurthy/notablog/bin/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/janakymurthy/notablog/bin/cli.js:3:48)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/janakymurthy/notablog/bin/cli.js' ]
}

Reverting back to old symlinks somehow fixes this. Note: I have cloned this repo at /Users/janakymurthy/notablog/. Am I missing some step?

@MihaiAnca13
Copy link
Author

@JanakyMurthy
Try installing the dependencies. Go to where you cloned this repo and run npm install. Hope it helps!

@JanakyMurthy
Copy link

JanakyMurthy commented Sep 23, 2021

@dragonman225 any update on when this pull request will be merged? I am not able to modify the source code now as I have parse-table.ts file instead of parse-table.js. It will be really useful to have a way to map links to sub-pages!!

@dragonman225
Copy link
Owner

Hi, it's not likely to be merged since the codebase has changed too much.
Sorry that I didn't look into this issue quite well and just kept making what I want!
Could you elaborate what is it like to "map links to sub-pages"? Maybe by showing the table you are using?

@JanakyMurthy
Copy link

Hi, it's not likely to be merged since the codebase has changed too much.
Sorry that I didn't look into this issue quite well and just kept making what I want!
Could you elaborate what is it like to "map links to sub-pages"? Maybe by showing the table you are using?

@dragonman225 Say Page 1 has a text that links to subpage 2. When I export it using notablog the url of subpage 2 is a notion url instead of a local url. I understand that it is too much to ask for this use case for an arbitrary subpage 2. But suppose subpage 2 is a valid blog post (Say it is in the table) - then how do we reference it?

@JanakyMurthy
Copy link

Hi, it's not likely to be merged since the codebase has changed too much.
Sorry that I didn't look into this issue quite well and just kept making what I want!
Could you elaborate what is it like to "map links to sub-pages"? Maybe by showing the table you are using?

@dragonman225 Say Page 1 has a text that links to subpage 2. When I export it using notablog the url of subpage 2 is a notion url instead of a local url. I understand that it is too much to ask for this use case for an arbitrary subpage 2. But suppose subpage 2 is a valid blog post (Say it is in the table) - then how do we reference it?

I am also wondering if this can be done for an arbitrary subpage 2? what are the complications that can arise? Suppose we have a function that can generate distinct local-urls for given notion-url, then can this be done too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants