Comments (13)
Ready to TypeScript now. hover
, mode-loader
, read-link
and insert-file
are refractored. There are still lots of work to do.
from hypermd.
@nokola TypeScript branch is already merged to master.
Note that there are still some unfinished / untested codes in master branch. You may find a stabler version in "Releases". If something abnormal occurred, feel free to post here.
from hypermd.
Code goes to refactoring-with-ts branch
Rollup is good but there is still something wrong in my configuration...
Emmm... what the hell is
'../../hypermd/addon/'
?!
HyperMD/dist/addon/insert-file.js
Lines 2 to 4 in f108ab1
from hypermd.
re: '../../hypermd/addon/' -> looks like you fixed it, probably some issue with import or base folder.
"Deal with the poorly-typed @types/codemirror": I noticed for some function calls I had to replace them to use Doc instead of Editor. e.g. cm.getCursor() change to cm.getDoc().getCursor(). I think this is intentional because CodeMirror.Doc is the better location to deal with cursor/etc. The old functions are left working only for legacy purposes.
from hypermd.
A workaround is that let CodrMirror.Editor extends CodeMirror.Doc , which is now written in "src/core/type.d.ts". I'm not sure whether multi-doc feature is important. If it is, lots of add-ons will need to rewrite. So let's just put this aside for a while
from hypermd.
Sounds good. I wonder about multi-doc feature too. Perhaps slowly over time can switch to using getDoc().
Personally I always use the getDoc() since I started with typescript anyway.
from hypermd.
Just found something very interesting! See parcel js - a module bundler with what they say very good typescript support https://parceljs.org/transforms.html
I haven't read much about it yet.
Edit: after more reading, found out "microbundle" as another alternative.
Many places note that "rollup" that you use is a good choice for npm libs.
Anyway please ignore this comment since rollup looks like working well already for you :)
from hypermd.
(part of) BREAKING CHANGES
Powerful Fold System!
Fold
addon is now much more efficient and extensible.
A developer may implement a FolderFunc
to fold anything. A example can be found in FoldMath, only 60 lines(with comments).
The new Fold add-on makes it very easy to support Markdown Diagrams and render them with 3rd libraries like flowchart.js, PlantUML etc.
Lines 17 to 29 in 25b4431
Click Handers
hmdClick
option can be a ClickHandler function, which may supress HyperMD default behaviors by returning false
:
Lines 17 to 38 in 25b4431
Addon Skeleton
Boilerplate to start a new add-on quickly. See skeleton.ts
Once a new add-on is ready-to-test:
- Add to
components
in rollup.config.js - Edit demo/index.js and load it
- Edit src/core/quick.ts and provide a suggested option value
yarn dev
@nasyxx interested in composing CONTRIBUTING.md? I do feel frustrated with my poor English now.
from hypermd.
Happy to unroll my custom changes to make it work in webpack and try this changeset :)
Will keep you posted.
from hypermd.
using your branch at commit 955fffe
$ yarn build 19:25
yarn run v1.6.0
$ npm run build_js && npm run build_css
> [email protected] build_js /home/cedric/src/HyperMD
> rollup -c
./src/core.ts → ./core.js...
[!] (rpt2 plugin) Error: /home/cedric/src/HyperMD/src/core.ts(5,24): semantic error TS2307 Cannot find module './core/Addon'.
src/core.ts
Error: /home/cedric/src/HyperMD/src/core.ts(5,24): semantic error TS2307 Cannot find module './core/Addon'.
at error (/home/cedric/src/HyperMD/node_modules/rollup/dist/rollup.js:199:15)
at Object.error (/home/cedric/src/HyperMD/node_modules/rollup/dist/rollup.js:17311:21)
at RollupContext.error (/home/cedric/src/HyperMD/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:17215:30)
at /home/cedric/src/HyperMD/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:19860:23
at arrayEach (/home/cedric/src/HyperMD/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:546:11)
at forEach (/home/cedric/src/HyperMD/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:9372:14)
at printDiagnostics (/home/cedric/src/HyperMD/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:19833:5)
at Object.transform (/home/cedric/src/HyperMD/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:20104:17)
at /home/cedric/src/HyperMD/node_modules/rollup/dist/rollup.js:17316:48
at process._tickCallback (internal/process/next_tick.js:68:7)
beside this issue that I fixed with a rename, I still have troubles getting it to work. I will investigate later, I run out of time today.
from hypermd.
@cgestes
I use Windows and filenames are case-insensitive. Thanks for reporting this bug.
The package on NPM is now tested (with parcel-bundler
) and works well. See http://laobubu.net/HyperMD/#./docs/index.md
from hypermd.
Ok thank you. I'll see it seems there is some migration required. I'll keep you posted
Thanks for the great addons.
from hypermd.
Will you merge the typescript branch before the documentation? I think the documentation can be a separate task - for me typescript support is an awesome thing of it's own :)
from hypermd.
Related Issues (20)
- Non-techie mode? HOT 1
- 关于主题和代码高亮
- 请问如何编译 import 的其他包的内容 HOT 2
- flow 左右分屏容易改造吗?
- Supporting syntax highlight for code block HOT 4
- :::info:::,
- Repo Active
- Cannot convert from `GLib.List<Gtk.Window>' to `GLib.List<weak Gtk.Window> HOT 1
- 官方能出VScode或者Nextcloud这种私有云的插件吗?
- How to import this as ES Module? HOT 2
- Not Highlighting code blocks in vue HOT 1
- Cant seem to get it working, always producing error
- The text box is wobbling badly
- The demo address cannot be opened HOT 1
- Hypermd syntax highlighter stops working inside a code block (Obsidian's Admonition-plugin, CodeMirror) HOT 1
- How to disable folding
- Demo site is down
- 文档和测试站点宕机了
- CodeMirror 6
- Working on a fork supporting CodeMirror 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hypermd.