neocotic / europa Goto Github PK
View Code? Open in Web Editor NEWLibrary for converting HTML into valid Markdown
License: MIT License
Library for converting HTML into valid Markdown
License: MIT License
A very small request. On the API page (http://neocotic.com/html.md/#api) add an example of md called with options. Eg. md(myHTML, {inline: 1})
(BTW, I presume this is correct. At least it works in my code).
Thanks for the good work!
mario
component.json
is long since deprecated/unused by Bower so we should rename our file to bower.json
accordingly.
Use a service like Coveralls to track code coverage which would be generated by the build after using something like Istanbul or Blanket.js.
An initial threshold of 95% would be good, but ideally we should have 100%.
π I loved CoffeeScript, but I've found it harder to maintain projects that use it and the source code becomes less predictable.
I'm going to switch back to JavaScript, however, we'll be using ECMAScript 6/2015 features, supported by Babel which will compile/transpile the source code to the lib
directory. I'm also considering using Browserify to generate both production and development files for browsers. I'm not too familiar with Browserify though so I'll need to look into how to do all that I want.
Regardless of what is done, source maps be produced by the build to enable
Add an EditorConfig file to the project to make it easier for new developers to contribute to the new standards.
I'm using version 3.0.2 of html-md and i'm getting the below error when I require html-md in my project.
npm version: 3.3.7
node version: v0.12.7
Error: Cannot find module 'canvas' from '..../node_modules/html-md/node_modules/jsdom/lib/jsdom/level2'
For example; embedded code.
Only some of these have already been done as part of #3 but I'd like to do a lot more now.
Since jsdom is causing headaches for Windows users, are alternatives like cheerio or [htmlparser2](https://www.npmjs.org/package/htmlparser2] being considered?
We're currently only testing against node v0.8. Not only is this a very old version, but we need to test against more versions. I really just want to concentrate on the last version of previous major releases and the latest versions of node. For example:
I'm not keen on adding "iojs" since that's now merged into node so shouldn't really be required.
This should be pretty straight forward but will have consequences, especially for jsdom, where the latest versions require us to now only support Node v4 and above due to their usage of ES6/2015. However, we'll be adopting the same principles to avoid having to use Babel for anything other than browser support.
Run command:
$ browserify ./your-module.js
Throws:
Error: module "canvas" not found from "/node_modules/html-md/node_modules/jsdom/lib/jsdom/level2/html.js"
Where your-module.js
requires html-md
. Tested with browserify v3.5.0, html-md v3.0.2.
I want to publish all distribution files to cdnjs. I've already directed the download links in README.md
to the CDN, I just need to get them publish.
This will be configured to be auto-updated based on npm releases to prevent the need to be manually updated for each release.
I'll update this issue with a link to the PR when it is known.
With the release of Europa, I'm going to be changing the existing homepage to simply redirect to this repository. I'd like to create a new homepage to be hosted on GitHub Pages (https://notninja.github.io/europa).
If it gets traffic, I'll consider paying for a custom domain, but not until then as I've made that mistake before πΈ. I'm also not 100% sure how I'm going to manage funds for !ninja costs yet, currently they all come out of my own pocket.
The new homepage should be clean and informative, making usage documentation and a live demo the primary content. Once it's up and running, all references to a "homepage" should be changed to point at it.
I know that I just split out the code into multiple modules and repositories in #71 (Europa release), however, it's already becoming challenging for maintaining versioning and collaboration. While we still only have a few modules, I'd like to take the opportunity to converge into a monorepo. That way, I can perhaps ignore the loss of git history (unless there's an easy way to preserve it).
I'll be looking at using something like Lerna to make it easier to publish etc. I was waiting for it to be adopted more and thoroughly tested, and babel has been using it for some time now. The packages will remain the same, they'll just all fall under this repository.
This should not involve a breaking change so can be done in a minor release. I'll add more info to this issue as my investigation begins.
When html is malformed the tests are failing. When html is like:
<html>
....
<command>Some contents</command>
</html>
The generated markdown will contain Some contents. The tests don't expect Some contents and are therefore failing.
Aside: Not really an issue per se, but is it not the best way to induce notifications in that blue dot box next to the Github... uh Octocat logo (what happened to the Github one?) - if not the only way?*
If I got any of the terminology wrong, please correct me - I'm more concerned about the thing doing its thing than I am what I termed it.
I don't think I can "assign" myself on your repo, but if you want to you can assign me and/or whoever else
Add events to the md
variable when executed in the node.js environment.
This will provide users an alternative approach to using the library as well as a more in-depth exposure to the inner-workings.
I've not yet decided exactly what events will be and what data will be passed to their listeners.
I install it and then i got an error. have a look on the bottom
sudo npm install html-md -g
npm http GET https://registry.npmjs.org/html-md
npm http 304 https://registry.npmjs.org/html-md
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/fs-extra
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/fs-extra
npm http 304 https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/ncp
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/jsonfile
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/htmlparser2
npm http GET https://registry.npmjs.org/nwmatcher
npm http GET https://registry.npmjs.org/xmlhttprequest
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/ncp
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/jsonfile
npm http 304 https://registry.npmjs.org/htmlparser2
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/nwmatcher
npm http 304 https://registry.npmjs.org/xmlhttprequest
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssstyle
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/domhandler
npm http GET https://registry.npmjs.org/domutils
npm http GET https://registry.npmjs.org/domelementtype
npm http GET https://registry.npmjs.org/readable-stream
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/cookie-jar
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/form-data
npm http 304 https://registry.npmjs.org/bindings
[email protected] install /usr/local/share/npm/lib/node_modules/html-md/node_modules/jsdom/node_modules/contextify
node-gyp rebuild
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/domhandler
npm http 304 https://registry.npmjs.org/readable-stream
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/aws-sign
npm http 304 https://registry.npmjs.org/oauth-sign
npm http 304 https://registry.npmjs.org/domutils
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/cookie-jar
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/domelementtype
npm http 304 https://registry.npmjs.org/ctype/0.5.2
CXX(target) Release/obj.target/contextify/src/contextify.o
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/asn1/0.1.11
npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
SOLINK_MODULE(target) Release/contextify.node
npm http 304 https://registry.npmjs.org/hoek
SOLINK_MODULE(target) Release/contextify.node: Finished
npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5
/usr/local/share/npm/bin/html-md -> /usr/local/share/npm/lib/node_modules/html-md/bin/html-md
[email protected] /usr/local/share/npm/lib/node_modules/html-md
βββ [email protected]
βββ [email protected] ([email protected], [email protected], [email protected], [email protected])
βββ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
pascals-MacBook-Pro-3:editor pascal$ html-md --version
env: node\r: No such file or directory
pascals-MacBook-Pro-3:editor pascal$ html-md
env: node\r: No such file or directory
pascals-MacBook-Pro-3:editor pascal$ grunt --version
grunt-cli v0.1.9
pascals-MacBook-Pro-3:editor pascal$ node -v
v0.10.18
Currently using an unsupported method of defining our module. The fix should simply be as follows:
define -> md
When list element tags are unformatted like the following:
<ul><li>item1</li><li>item2</li></ul>
The application returns:
* item1* item2
It should return:
* item1
* item2
Add a new command line interface which works using stdin
and stdout
while supporting option flags.
For example;
$ md < index.html
# Example
Welcome to this example page.
$ md "<strong>foo</strong>"
**strong**
$ echo "<em>bar</em>" | md
_bar_
Is there any plan to support text attributes like bold, italic, strikethrough?
Create a Cakefile/Makefile to handle this. Tasks should include:
Unfortunately, when I first created html.md my understanding of open source licenses was limited and, even though I have always credited the author and referenced the original GPLv2 license of the bookmarklet (Make.text) on which html.md was based, it it is not permissible to release modified GPLv2-licensed code under a different license (especially one as permissible as MIT).
Although the code of html.md barely resembles that of the original bookmarklet anymore and I have had no requests from anyone to change the license, I cannot continue to distribute html.md under MIT.
html.md v3.1 will have the license corrected to GPLv2.
However, I realize that GPLv2 is not ideal for everyone and that there's a lot of changes that I've wanted to make for a long time. Now that I'm freed up (slightly) and before I've got no time at all (:baby:), I'm going to completely rewrite html.md from scratch with plugin support baked in.
html.md v4 will be an entire new code base -- not based on anything -- and so will be released under the MIT license and with a whole new name altogether (TBA π).
Doh! Forgot to update the md.VERSION
.
Would be nice if this was automated...
If I run the following on the command line;
$ md -e "<b>test</b>"
A null.md
file is created in the current directory. I don't want anything to be created or displayed if -e
is used without -p
.
<i>some text </i> here
converts to _some text _ here
Markdown syntax documentation says:
if you surround an * or _ with spaces, itβll be treated as a literal asterisk or underscore
So when _some text _ here
is converted back to HTML it results in _some text _ here
instead of <i>some text</i> here
Is there any chance of getting this implemented?
I want to add a preliminary man page to the package.
This will be similar to the --help
option but with added usability for linux users.
Doh!
When using IE 8, I encountered the following error a couple times: "Object doesn't support this property or method."
In the first case, html-md retrieved the style
attribute of an element and called the match()
method on the returned string. However, I found IE 8 returned a CSSStyleDeclaration object instead of a string, which caused the match()
call to fail.
In the second case, html-md tried to access properties of window.Node
. Unfortunately IE 9 was the first IE version to support window.Node
so IE 8 and older versions fail.
Look at using jsdom.
Although detached or generated elements cannot have their styles computed and therefor visibility determined, the style.display
property should at least be checked.
Also, it's probably worth while checking the visibility
property.
more<i> text</i> here
converts to more_text_ here
It should be more _text_ here
basically this line
I was trying to markdown an array of 350k records, kept running into memory allocation problems, I was able to narrow it down to the synchronous require('jsdom')
being called every time.
but html.md don't apply
Granted, Windows can be tricky, but I think this is fairly trivial. Just not sure as to how to sym-link the "coffee" command to the correct place in $PATH.
The error returned is:
...npm/md::
line 12: coffee: command not found
I tracked down the offending file as this bugger (aptly and acutely named md ):
#!/bin/sh basedir=
dirname "$0"
case
unamein *CYGWIN*) basedir=
cygpath -w "$basedir";; esac
if [ -x "$basedir/coffee" ]; then "$basedir/coffee" "$basedir/node_modules/html-md/bin/md" "$@" ret=$? else coffee "$basedir/node_modules/html-md/bin/md" "$@"
This β seems to be line 12
ret=$? fi exit $ret
ST2 opens it as a markdown file, but it looks like coffeescript or php or perl or js or the bastard child of all of them. I will try on my side, in my fork to rewire something (and check my local env too - it could be corrupted somewhere, somehow).
Also, will test on some Linuxes.
When enabled (via the options) the parser should only clean specified HTML elements (i.e. remove all of their attributes) instead of replacing them with Markdown. When "cleaning" an element, all of its children will also be "cleaned" by the parser instead of converted into Markdown.
This functionality will be extremely useful when using tables.
The option should allow users to specify an array of specific tags;
md html, inline: ['p', 'table']
In this example it would "clean" all <p>
and <table>
tags, along with all their children.
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
The page was created when I published v4 (Europa), but I never actually got around to writing the guide yet:
https://github.com/NotNinja/europa/wiki/Migrating-from-older-versions
I just want to track this so I don't forget entirely.
I have tried updating NVM and node but this issue remains unresolved.
var md = require('html-md');
md('I <em>love</em> html.md!');
Running this in node yields this error
/Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/build/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/build/Debug/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/build/Release/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/out/Debug/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/Debug/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/out/Release/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/Release/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/build/default/contextify.node
β /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/compiled/7.10.0/darwin/x64/contextify.node
at bindings (/Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/bindings/bindings.js:88:9)
at Object.<anonymous> (/Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/lib/contextify.js:1:96)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/jsdom/lib/jsdom/browser/index.js:17:21)
Upon further inspection, it looks like there was an installation issue with contextify.
Exit code: 1
Command: sh
Arguments: -c node-gyp rebuild
Directory: /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp http GET https://nodejs.org/download/release/v7.10.0/node-v7.10.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v7.10.0/node-v7.10.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v7.10.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v7.10.0/SHASUMS256.txt
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/inspiredtolive/.yarn/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/inspiredtolive/.yarn/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/inspiredtolive/.node-gyp/7.10.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/inspiredtolive/.node-gyp/7.10.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/inspiredtolive/.yarn/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc:131:56: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
Local<Object> wrapper = Nan::New(constructor)->NewInstance();
^
/Users/inspiredtolive/.node-gyp/7.10.0/include/node/v8.h:3662:52: note: 'NewInstance' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version", Local<Object> NewInstance() const);
^
../src/contextify.cc:150:16: error: no member named 'SetAccessCheckCallbacks' in 'v8::ObjectTemplate'
otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,
~~~~~ ^
../src/contextify.cc:182:51: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
Local<Value> rv = Nan::New(ctx->sandbox)->GetRealNamedProperty(property);
^
/Users/inspiredtolive/.node-gyp/7.10.0/include/node/v8.h:3234:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
Local<Value> GetRealNamedProperty(Local<String> key));
^
../src/contextify.cc:209:38: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
if (!Nan::New(ctx->sandbox)->GetRealNamedProperty(property).IsEmpty() ||
^
/Users/inspiredtolive/.node-gyp/7.10.0/include/node/v8.h:3234:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
Local<Value> GetRealNamedProperty(Local<String> key));
^
../src/contextify.cc:210:42: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
!Nan::New(ctx->proxyGlobal)->GetRealNamedProperty(property).IsEmpty()) {
^
/Users/inspiredtolive/.node-gyp/7.10.0/include/node/v8.h:3234:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
Local<Value> GetRealNamedProperty(Local<String> key));
^
4 warnings and 1 error generated.
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/inspiredtolive/.yarn/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:194:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/Users/inspiredtolive/.nvm/versions/node/v7.10.0/bin/node" "/Users/inspiredtolive/.yarn/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/inspiredtolive/Desktop/Apps/improved-potato-bot/node_modules/contextify
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
at ChildProcess.proc.on.code (/Users/inspiredtolive/.yarn/lib/util/child.js:107:15)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at Pipe._handle.close [as _onclose] (net.js:511:12)
Any idea on how to fix this?
<span style="font-weight:700">text -> **text
Thank you for this fantastic gem! I really appreciate your work.
There are no commits and absolutely no activity in the last 6 months. Is this project still alive?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.