Skip to content

Feat(parser): add a file extention property #709

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

Closed
wants to merge 2 commits into from

Conversation

takker99
Copy link
Contributor

@takker99 takker99 commented Jun 1, 2021

Proposed Changes

  • add the property lang in CodeBlock
  • enable to parse filenames like hello.ts(js)

takker99 added 2 commits June 1, 2021 23:04
- add the property `lang` in `CodeBlock`
- enable to parse filenames like `hello.js(ts)`
@@ -9,6 +9,7 @@ export interface CodeBlock {
indent: number
type: 'codeBlock'
fileName: string
lang: string
Copy link
Owner

@progfay progfay Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language of CodeBlock is not simple in Scrapbox.
For example, language of code:cljc is clojure, code:processing is java.

This change only provides the file extension, and property name lang is not suitable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior of lang is equal to scrapbox.Page.lines, so I thought it was natural to push a file extension into lang.

  • For example:
  • Image from Gyazo
    But I also understand property name lang is not suitable. I'm going to close this PR.

@progfay
Copy link
Owner

progfay commented Jun 1, 2021

Thank you for your Pull Request!

But, this package will not support for file extensions.
For getting extension of filename in CodeBlock, try to parse filename yourself.
If you use this package in Node.js, path.extname is very useful.

@takker99
Copy link
Contributor Author

takker99 commented Jun 1, 2021

Thank you for your review!

At least I wanted you to implement parsing filenames like script.gs(js) so that I recreated code block URLs easily.
But I understand the reason you will not support file extensions. I'll parse file extensions and script.gs(js) by myself.

@takker99 takker99 closed this Jun 1, 2021
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.

2 participants