Giter Club home page Giter Club logo

Comments (5)

qrzbing avatar qrzbing commented on May 22, 2024

In web/src/components/MemoEditor.tsx:handleSaveBtnClick, Memos Web getMatchedNodes from content.

    // Upsert tag with the content.
    const matchedNodes = getMatchedNodes(content);
    const tagNameList = uniq(matchedNodes.filter((node) => node.parserName === "tag").map((node) => node.matchedContent.slice(1)));
    for (const tagName of tagNameList) {
      await tagStore.upsertTag(tagName);
    }

getMatchedNodes match nodes by some rules defined in web/src/labs/marked/parser/, and what we interested in is web/src/labs/marked/parser/Tag.tsx. It extracts tags by regular expression /#([^\s#]+)/.

I have added some code to update tags, but I don't find a good expression which can find all tags. Thanks if somebody could help me!

from moememosandroid.

qrzbing avatar qrzbing commented on May 22, 2024

When I test a case like this:

#111 #222 #测试 #cs 测试

It can not identify chinese tags and English tags.
image

But if I do not match digits, it will work as expected:
image

from moememosandroid.

mudkipme avatar mudkipme commented on May 22, 2024

Thanks for the discussion!

One thing we need to take into account is # mark in certain Markdown elements (code block, links, images, etc) should be avoided. I guess it could be done with intellij-markdown.

Or I wonder whether it's possible extend intellij-markdown to support tags in a native way. (That will let memo card render tags too)

from moememosandroid.

qrzbing avatar qrzbing commented on May 22, 2024

Thanks for the discussion!

One thing we need to take into account is # mark in certain Markdown elements (code block, links, images, etc) should be avoided. I guess it could be done with intellij-markdown.

Or I wonder whether it's possible extend intellij-markdown to support tags in a native way. (That will let memo card render tags too)

Yes, you are right, I forget # is widely used in different elements. I have some questions about where to parse markdown elements in MemoInputPage.kt:submit. I find Markdown is used in Memocard.kt, but we may analyze markdown elements in submit method?

For I have accomplish updateTag API (it is easy) and not sure how to accomplish parser, can I take a pr for only updateTag API or accomplish all features? I'm not a Android developer, and I'm a new hand in open source contribution. Thank you!

from moememosandroid.

mudkipme avatar mudkipme commented on May 22, 2024

Thanks for the discussion!
One thing we need to take into account is # mark in certain Markdown elements (code block, links, images, etc) should be avoided. I guess it could be done with intellij-markdown.
Or I wonder whether it's possible extend intellij-markdown to support tags in a native way. (That will let memo card render tags too)

Yes, you are right, I forget # is widely used in different elements. I have some questions about where to parse markdown elements in MemoInputPage.kt:submit. I find Markdown is used in Memocard.kt, but we may analyze markdown elements in submit method?

For I have accomplish updateTag API (it is easy) and not sure how to accomplish parser, can I take a pr for only updateTag API or accomplish all features? I'm not a Android developer, and I'm a new hand in open source contribution. Thank you!

Thanks! It's super welcome for any contribution and it's not required to be feature completed 😆

For reference, the parser used by MemosCard is https://github.com/mudkipme/MoeMemosAndroid/blob/main/app/src/main/java/me/mudkip/moememos/ui/component/Markdown.kt#L41

from moememosandroid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.