Autolink username via the `@username` syntax miss
@swole_hamster is showing as @swole_hamster ... EDIT: ... from here.
Ref:
- https://github.com/OpenUserJs/OpenUserJS.org/commit/091ef9cb40ea716fd30c138a7fb87b2bae0bb9c7 (miss here probably because tokens are split with regular expression look-ahead non-capture default from here ... or try to use marked lexer?)
- https://github.com/OpenUserJs/OpenUserJS.org/commit/6d31f785ce562ccbe820e66fa2d7f85fea5f7930 (possibly revert until a work-around or fix is found)
Trace:
> renderer.text()
Crowd Task Google Search Link by @swole
> renderer.text()
_hamster
And another one with [email protected] here.
Possibly need to see if there is a look ahead and a look behind option... and during require a space before the at symbol.
To stop matching email addresses replace the regex here with this: /(?:^|\s)@([^\s\\\/:*?\'\"<>|#;@=&]+)/
I'm not sure why the underscore is breaking the match yet.
I'm not sure why the underscore is breaking the match yet.
The reason is in the trace message... e.g. the package is splitting a "chunk", processing that "chunk", and we're missing it due to routine we are using with it... this is why it would be useful to have a look ahead and look behind with that package so we could see if the "chunk" needs aggregation.
To be fair. The text rendering method isn't one listed in the official api. I found it by going through the source of the package.
The html renderer method would work, but I was trying to avoid linking in code and pre blocks.
We could probably do it in here but skip when aType === 'html' so we don't do it twice.
I'll take this issue since it was my feature.
but I was trying to avoid linking in code and pre blocks.
Might be a little irritating when we get notifications (#15 and/or #242) but may not... since I can divine this is another reason why you wanted this feature. ;)
@sizzlemctwizzle
Should this be autolinking in code md blocks? e.g. @sizzlemctwizzle ??
@sizzlemctwizzle Cc: @Zren
Do either of you know if there is an equivalent of DocumentFragment in node (preferably native)? It seems that we need to check the parent node to see if it's a pre or code tag... if so don't do the replacing. Using a regular expression with dynamic content can get tricky. Back on USO I started using a document fragment to detect things... in this case we would possibly need to modify the text nodes then export out the innerHTML equivalent, assuming there is one.
Closest non-native I have found is html-document but that says it is only a partial implementation.
I do see a xml parser/serializer at xmldomᴳᴴ (with xpathᴳᴴ)... it seems to me that express should have this as a method somewhere though. e.g. convert a string to a DOM and a DOM to a string for html (poorly formed) and xml (strictly formed).
Another miss at https://openuserjs.org/scripts/TimidScript/%5BTS%5D_Pixiv++/issues/Pixivv++#comment-15140bea129 with a trailing comma.
Moving this to later... @sizzlemctwizzle I would suggest not implementing notifications until this is finalized... there's a bunch of work to do with some research before we can implement that feature correctly.
Ref:
- https://www.npmjs.com/package/jsdom perhaps on the DOM angle.
Moving this to GH dev discussion.
Currently @_foo_ and @~foo~ is an issue still.
I think what should happen is:
- Sanitize the content
- Replace the
@mentions - Render with marked
... or ...
- Replace the
@mentions - Render with marked
- Sanitize the content
Currently it:
- Renders with marked
- Sanitizes the content
- Replaces the
@mentions
Notes:
- Be careful not to bust rendering... I seem to recall there was a prior issue on order. This concept will need to be thoroughly tested.
Refs:
- Current code point at https://github.com/OpenUserJS/OpenUserJS.org/blob/b54f20a7d37f53e34e7c5f7033b1723264e46dd9/libs/markdown.js#L67-L70