DiscoTOC - 自动目录

我们针对直接子级标题,以排除标题中的引用或 onebox 以及目录中的其他元素。否则,我们将不得不单独排除它们,这会很麻烦。

6 个赞

您好,

我们如何在表格中将标题设为粗体,副标题设为普通字体?

1 个赞

你好!你必须用 CSS 来做。

1 个赞

但是,我没有 CSS 经验,有现成的模板吗?

1 个赞

您应该可以在您的网站主题的 CSS 部分添加类似以下内容:

.d-toc-heading > li > a {
  font-weight: bold;
}

……这将看起来像这样:

3 个赞

DiscoTOC 是一个很棒的组件,非常感谢。
有没有可能与这个插件结合使用:

5 个赞

效果很好,谢谢,但如何为子子字体添加粗体?

例如:
主字体
子字体
子子字体
子子子字体

因为我的上下文中存在 4 个级别的子字体。

谢谢

1 个赞

抱歉,我不确定我是否理解——您是想让目录中的所有链接都使用相同的字体吗?如果是这样,您可能可以使用类似以下的方法:

#d-toc a {
  font-weight: bold;
}

如果您想为不同级别的标题设置不同的样式,则需要更复杂一些的方法:

// 一级标题样式
.d-toc-heading > li > a {
  font-weight: bold;
}

// 二级标题样式
.d-toc-heading > li > ul > li > a {
  color: red;
}

// 三级标题样式
.d-toc-heading > li > ul > li > ul > li > a {
  color: green;
}

// etc.

请注意,这与主题组件的实现紧密相关,因此如果该组件将来发生更改,您可能需要更新这些规则。

4 个赞

非常感谢,这正是我想要的。

2 个赞

目前没有计划支持已发布的页面。它与 docs 插件一起支持。

1 个赞

:iphone:移动视图中显示 DiscoTOC 桌面模式是否存在任何问题?

我们在 2.7.x 版本中遇到此问题,即使在更新到 2.8 版本后仍然存在,请参见此处:
https://forum.cannabisanbauen.net/docs?topic=2272

1 个赞

打扰一下!Joe
今天,我更新了 Discourse,我的 DiscoToc 显示完全正确,但屏幕宽度却坏了。
我更新了最新的 Disco Toc 主题组件。
您能继续修复这个问题吗?

https://nganhangbatdongsan. com/t/bang-gia-xem-data-nha-chinh-chu/63389

谢谢!

1 个赞

所以这不是 DiscoTOC 的问题,而是因为您还启用了 layouts 插件占用了空间。

3 个赞

仍然遇到相同的问题;不得不删除旧版本的 DiscoTOC,该版本至少可以安装/工作,因为它与最新的 Discourse 不兼容。

/log 摘要是:

Aws::S3::Errors::InvalidArgument (不支持的罐装 ACL 值“public-read”)
lib/s3_helper.rb:74:in `upload'
lib/file_store/s3_store.rb:116:in `store_file'
lib/file_store/s3_store.rb:30:in `store_upload'
lib/upload_creator.rb:212:in `block (2 levels) in create_for'
lib/upload_creator.rb:211:in `open'
lib/upload_creator.rb:211:in `block in create_for'
lib/distributed_mutex.rb:33:in `block in synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:14:in `synchronize'
lib/upload_creator.rb:64:in `create_for'
app/models/remote_theme.rb:164:in `block in update_from_remote'
app/models/remote_theme.rb:160:in `each'
app/models/remote_theme.rb:160:in `update_from_remote'
app/models/remote_theme.rb:93:in `import_theme'
app/controllers/admin/themes_controller.rb:104:in `import'
app/controllers/application_controller.rb:397:in `block in with_resolved_locale'
app/controllers/application_controller.rb:397:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:358:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:202:in `call'

以及回溯:

aws-sdk-core (3.121.2) lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'
aws-sdk-s3 (1.96.1) lib/aws-sdk-s3/plugins/sse_cpk.rb:24:in `call'
aws-sdk-s3 (1.96.1) lib/aws-sdk-s3/plugins/dualstack.rb:36:in `call'
aws-sdk-s3 (1.96.1) lib/aws-sdk-s3/plugins/accelerate.rb:50:in `call'
aws-sdk-core (3.121.2) lib/aws-sdk-core/plugins/jsonvalue_converter.rb:22:in `call'
aws-sdk-core (3.121.2) lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'
aws-sdk-core (3.121.2) lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'
aws-sdk-core (3.121.2) lib/seahorse/client/plugins/request_callback.rb:71:in `call'
aws-sdk-core (3.121.2) lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'
aws-sdk-core (3.121.2) lib/seahorse/client/plugins/response_target.rb:24:in `call'
aws-sdk-core (3.121.2) lib/seahorse/client/request.rb:72:in `send_request'
aws-sdk-s3 (1.96.1) lib/aws-sdk-s3/client.rb:11274:in `put_object'
aws-sdk-s3 (1.96.1) lib/aws-sdk-s3/object.rb:1329:in `put'
lib/s3_helper.rb:74:in `upload'
lib/file_store/s3_store.rb:116:in `store_file'
lib/file_store/s3_store.rb:30:in `store_upload'
lib/upload_creator.rb:212:in `block (2 levels) in create_for'
lib/upload_creator.rb:211:in `open'
lib/upload_creator.rb:211:in `block in create_for'
lib/distributed_mutex.rb:33:in `block in synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:14:in `synchronize'
lib/upload_creator.rb:64:in `create_for'
app/models/remote_theme.rb:164:in `block in update_from_remote'
app/models/remote_theme.rb:160:in `each'
app/models/remote_theme.rb:160:in `update_from_remote'
app/models/remote_theme.rb:93:in `import_theme'
app/controllers/admin/themes_controller.rb:104:in `import'
actionpack (6.1.4.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
app/controllers/application_controller.rb:397:in `block in with_resolved_locale'
app/controllers/application_controller.rb:397:in `with_resolved_locale'
i18n (1.10.0) lib/i18n.rb:328:in `with_locale'
app/controllers/application_controller.rb:397:in `with_resolved_locale'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.4.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.4.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (2.3.4) lib/mini_profiler/profiling_methods.rb:111:in `block in profile_method'
actionpack (6.1.4.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.4.1) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (6.1.4.1) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:842:in `call'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.1.4.1) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:358:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster (2.10.1) lib/logster/middleware/reporter.rb:43:in `call'
railties (6.1.4.1) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.4.1) lib/rails/rack/logger.rb:28:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/host_authorization.rb:92:in `call'
rack-mini-profiler (2.3.4) lib/mini_profiler/profiler.rb:393:in `call'
message_bus (4.2.0) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:202:in `call'
railties (6.1.4.1) lib/rails/engine.rb:539:in `call'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `public_send'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `method_missing'
rack (2.2.3) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.3) lib/rack/urlmap.rb:58:in `each'
rack (2.2.3) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/2.7.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/2.7.0/bin/unicorn:25:in `<main>'

env 摘要中的 URL 是:REQUEST_URI /admin/themes/import - 所以我确信我找到了正确的错误。

也许我无意中以非标准的方式进行了设置。我在 app.yml 中配置了 Backblaze (S3 API),并注释掉了 DISCOURSE_USE_S3,但输入了所有其他 S3 设置。DISCOURSE_BACKUP_LOCATION 设置为 S3。目标是保留本地图片等上传,但让备份发送到 Backblaze。在管理员网页上似乎没有启用任何 S3 设置。备份已出现在 Backblaze 上,我仍然可以添加图片等,所以我认为一切都很好。

任何建议都将不胜感激!

1 个赞

这不是 DiscoTOC 的问题。请在此元站点上搜索 Backblaze,看看是否能找到您问题的解决方案。(如果您找不到解决方案,请随时开设一个单独的支持主题。)

2 个赞

升级 Discourse 后,我们收到一个错误:

Screenshot from 2022-02-25 18-35-43

编辑:哦不,抱歉。那是在一个未更新的实例上。这可能是因为那个原因。

3 个赞

如果这对其他人有帮助,我之前在一个格式似乎正确的帖子中添加目录时遇到了困难,它一直没有显示出来。最后我检查了编辑历史记录:

Selection_022

将标签移到新行(并将其精简为仅一个实例)解决了问题。

3 个赞

您好,我遇到了以下问题。
如果存在中文标题,目录链接将无法正确链接到相应位置。
例如,KeepZotero 防止 Zotero 被關掉 - 綜合討論 - TW Community
点击右侧表格中从右往左数第2-5个链接时,总是会跳转到第二个标题的位置,而不是对应的位置。
如果点击标题左侧的链接,则可以正常工作,链接格式为 ${topic-url}#h-4
这是否与 Bug of DiscoTOC with Chinese Headings - bug - Discourse Meta 中提到的问题相同?

3 个赞

我认为是一样的

3 个赞

我在我的网站上尝试了您的修复,它工作正常。
您是否计划创建一个拉取请求?

2 个赞