-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showdown-ES #11
Comments
Why showdown? I have't used it yet. |
Because people still use it. Personally, I prefer marked as well but this org is about promoting the adoption of ES modules in the wider JS ecosystem. Sometimes that means building tools/libs, sometimes it means supporting other projects by supporting existing projects, sometimes it means building ESM forks of popular packages so users have a viable upgrade path. I submitted a PR that added ESM support to Showdown that sat untouched for 6 months. That's a pretty good signal that the project isn't very actively maintained. Creating a fork seems to be a good option here. |
Last publish was 9 months ago, so yeah, seems pretty dead to me. And it's quite well commented with js-docs style comments so it might be a good candidate. One thing i find strange is that no markdown parser (that i know of at least) seems to be using any kind of streaming but wait until all text is processed by a step before moving on. i was playing around with dom-mocking and advanced rendering for the terminal and had some great results as most of the node builtins accept streams. Anyways, i think it's some neat stuff you are doing here. never understood why people tend to pile frameworks ontop of eachother when modern JS/ES has made many of these things so easy to implement. |
I was going to do like I did in the PR but maintianing a full fork would suck. I think I'm just going to add a build script and ship a single bundle instead. I call these transitional packages. Maybe the Showdown Maintainers will decide to make it obsolete by adding ESM support later. IMO, most Markdown source isn't long enough to justify a stream parser. It makes a lot more sense for JSON/CSV because those can grow to Big Data size (ie GB+) and -- thus -- grow beyond the available memory. I don't think I've ever seen a MD doc that hits MB+ size. As for streaming parsers in general. They used to be more common b/c browsers has much steicter limits on memory (ie <10MB). Nowadays it seems like most limits have been massively increased or removed altogether.
Thanks 🙏. Maybe one day this project will grow into a thriving ecosystem. Who knows, maybe it'll even be self-sustaining. Until then, I plan to keep growing it slowly, documenting best practices, building tools. It's still a little too far ahead of common practices. I can't wait until the whole ecosystem shift to ESM begins. The focus says standards but the real target is building tools that are easy to Maintain on the 10+ year time scale. It's kinda hard to use stability, robustness as a selling point when everything here is new and shiny. It's even harder to demonstrate the value of maintainability, stability, good engineering when the majority of the JS ecosystem is still enthralled with new shiny things. There is a bigger picture being played out here. What looks 'crazy' today will gradually start to look a lot more like 'early' in the future. Just a little unsolicited advice. Don't bother with Typescript. Try building with ESM. Use Tape-ES for unit testing, it doesn't have the (literally) hundreds of thousands of transitive dependencies that Jest does. Use JSDoc for types, transform them to TS compatible Mocha is another ESM compatible testing framework if you can't stand Tape-style tests. To see how all of this is done, check out the NPM scripts used by the libraries in this org. Keep an eye on how ESMTK is going to replace a lot of those processes. I'm building it specifically to codify and simplify the entire toolchain used to develop ES modules. |
Of course. I wouldn't think about doing that normally, but as i'm targeting the terminal, i would have to write abstractions for large parts of it.
you're right, this is kind of a passion 'small' project for me, so it has evolved into much more than just a parser in my head allready. since i also need a renderer and more dynamic functionality than the usual use for markdown, streaming has a lot of benefits for evaluation and eventual rendering.
I think we are having a different image of TS in mind. I can't find a short way to explain it. I started using TS only a short while ago, so i don't have much presentable code. the TS sourceimport { fileURLToPath } from 'url'
import { readdir, rename } from 'fs/promises'
import * as path from 'path'
export const pkgPath = path.resolve(fileURLToPath(import.meta.url), '../')
export const localResolve = (...pathSegment) => path.resolve(pkgPath, ...pathSegment)
export async function * iterateDirs (options: any, ...dir: string[]) {
const defaultOptions = {
filter: /.*/
}
if (typeof options === 'string') dir.unshift(options)
else Object.assign(defaultOptions, options)
const directory = path.resolve(...dir)
for await (const dirent of await readdir(directory, { withFileTypes: true })) {
const filePath = path.resolve(directory, dirent.name)
if (dirent.isDirectory()) yield * this.iterateDirs(filePath)
else if (filter.test(dirent.name)) {
yield * new ReaderWriter(filePath)
}
}
} and after compilationimport { fileURLToPath } from 'url';
import { readdir } from 'fs/promises';
import * as path from 'path';
export const pkgPath = path.resolve(fileURLToPath(import.meta.url), '../');
export const localResolve = (...pathSegment) => path.resolve(pkgPath, ...pathSegment);
export async function* iterateDirs(options, ...dir) {
const defaultOptions = {
filter: /.*/
};
if (typeof options === 'string')
dir.unshift(options);
else
Object.assign(defaultOptions, options);
const directory = path.resolve(...dir);
for await (const dirent of await readdir(directory, { withFileTypes: true })) {
const filePath = path.resolve(directory, dirent.name);
if (dirent.isDirectory())
yield* this.iterateDirs(filePath);
else if (filter.test(dirent.name)) {
yield* new ReaderWriter(filePath);
}
}
} I started writing even small things in typescript. Because of how close it is to regular ES, i can use the same tsconfig for most things which saves me much of the setup-time that TS often has. And it allows me to benefit from the full TS-language-feature from the get-go. this way i can write faster and end up with more solid code. plus i can avoid some of the annoyances of jsdocs, while still using it for general doccumentation. I hope this made sense And i will try tape-es, i'm not a fan of mocca, tho, as i really don't like things that sully the global namespace without a very good reason. getting a little carried away here
node v14 is sceduled to enter LTS in late october. that's not far off. and this will mean that the "esm is still experimental"-excuse ain't gonna fly anymore. and because of the fast evolving nature of ES, the fraction of developers that embraces modernizing is quite large. and there is pressure for libraries and frameworks to adapt. The modern nature of ES is why i fell in love with the language. before coming to JS around early node v13, i've been programming in C# and various weird scripting-languages used in the games i modded. The goal wasn't to make something adequate, but to create an aww-inspirering Mod or technique that was thought to be impossible. And every feature-update of the game meant new possibilities to do so. |
Create an ESM package for ShowdownJS based on the work in this PR
The text was updated successfully, but these errors were encountered: