V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
0o0O0o0O0o
V2EX  ›  分享创造

Github Issues 与博客的(又)一个思路

  •  
  •   0o0O0o0O0o · 2022-02-04 13:46:44 +08:00 · 2683 次点击
    这是一个创建于 829 天前的主题,其中的信息可能已经有所发展或是发生改变。

    新年换笔记平台换得有点烦躁,于是自己乱折腾了个。

    有点类似于 issue-to-jekyll-post 这个项目,通过 issuesissue_comment 这两个 event 触发 Github Actions ,将对应的 issue 编译成 jekyll 的 _posts/*.md ,接下来就交给 Github Pages 了 。

    Github Issues 自身支持:

    • 全平台
    • 搜索
    • markdown 编辑器
    • 图片(博客域名如果是 user.github.io 则可以当作图床使用)
    • 文件
    • Label (可以对应 Tag )
    • Pin (可以对应置顶?)

    又是对话的方式,我觉得很适合用作记录一些碎片。

    由于是借助 git ,还可以通过 commits 查看历史。

    就算未来 Github Actions 不服务了,数据起码还在 Github ,我觉得比我自己保管要安全一点。

    设计了一些 inline commands ,选用了 markdown 里的三层 quote 作为标识,而不是容易影响 markdown 格式的 jekyll 的 YAML front matter 。刚好 github-actions 这个 app 对 issues 进行的操作是不会触发 Github Actions 的,可以用于编译修改包含 inline commands 的 issue/comment 。

      ```
      Usage:  >>> author [AUTHOR]
    
    
      Usage:  >>> description [line1]
              >>> description [line2]
              >>> description [line3]
    
    
      Usage:  >>> img [LINK]
      
      	![LINK]( https://user-images.githubusercontent.com/1234567/12345678.png)
    
    
      Usage:  >>> file [OPTIONS] [LINK]
    
        Options:
              --split             Split large file to zip files (default false)
              -o, --output <name> File name
    
        > [name](LINK)
    
        [name]( https://github.com/user/repo/files/1234567/default.pdf)
    
    
      Usage:  >>> code [OPTIONS] [LINK]
    
        Options:
              --lang  Identifier to enable syntax highlighting
    
    
      Usage:  >>> archive [LINK]
      ```
    
    第 1 条附言  ·  2022-02-04 14:46:16 +08:00
    inline commands 完成度一般,就不附链接了,大家觉得思路怎么样?有没有什么建议?或者有没有完成度较高的可供使用?
    10 条回复    2022-02-10 17:18:28 +08:00
    0o0O0o0O0o
        1
    0o0O0o0O0o  
    OP
       2022-02-04 13:48:01 +08:00
    inline commands 完成度一般,就不附链接了,大家觉得思路怎么样?有没有什么建议?
    jaywhen
        2
    jaywhen  
       2022-02-04 19:22:01 +08:00 via iPhone
    如果经常用 notion 的话结合 notion api 来搭博客挺爽的,就是要自己写如何 render block
    0o0O0o0O0o
        3
    0o0O0o0O0o  
    OP
       2022-02-05 20:37:09 +08:00
    实现了一点了,找了个库叫做 remark ,来实现 commands 的解析和替换。

    例如在 issue/comment 里随便添加一行

    >>> code --lang html <link>

    github actions 就会去抓取 link 的代码,生成 jekyll post ,并且将 issue/comment 中的这行替换成相应的 code block 。

    挺好
    0o0O0o0O0o
        4
    0o0O0o0O0o  
    OP
       2022-02-06 16:52:47 +08:00
    用 archivebox 实现 web archiving ,很久没关注它,发现效果有很大提升
    0o0O0o0O0o
        5
    0o0O0o0O0o  
    OP
       2022-02-06 19:52:09 +08:00
    @0o0O0o0O0o #4 archivebox 对公众号文章的支持不怎么样,它的 issue #318 有提到,可能会在它的 issue #51 解决(相当于自己写脚本来自定义行为),目前找到个叫 cairn 的工具对公众号文章的支持不错。
    saltbo
        6
    saltbo  
       2022-02-07 23:27:33 +08:00   ❤️ 1
    我之前也尝试过一段时间通过 issue 写 blog ,但 issue 的那个编辑框还是太简陋了。现在我用 notion 写。

    刚发了一个把 notion 内容发布到 blog 的工具,欢迎试用。 @jaywhen

    https://github.com/bonaysoft/notion-md-gen
    jaywhen
        7
    jaywhen  
       2022-02-08 10:43:51 +08:00 via iPhone
    @saltbo 我是用 Next.js 写的页面,然后在前端请求 notion api ,参考的 spencerwooo 的做法

    https://github.com/spencerwooo/spencerwoo.com
    0o0O0o0O0o
        8
    0o0O0o0O0o  
    OP
       2022-02-08 10:50:04 +08:00
    在功能方面基本上完成了自己想要的了,接下来就是抽空学习和重构代码了
    tousfun
        9
    tousfun  
       2022-02-10 15:12:35 +08:00 via iPhone
    @jaywhen 也是从 notion 的某个库里写博客,然后自动抓取吗?
    jaywhen
        10
    jaywhen  
       2022-02-10 17:18:28 +08:00
    @919615766 https://developers.notion.com/ 参考 notion api 文档获取 key ,然后自己写页面请求数据。可以参考 https://github.com/jaywhen/blog
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3213 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 12:54 · PVG 20:54 · LAX 05:54 · JFK 08:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.