Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ Script file | Description
[intercom_inside.ts](./examples/intercom_inside.ts) | An intercom script allowing communication with another room running the [intercom_outside.ts](./examples/intercom_outside.ts) script.
[intercom_outside.ts](./examples/intercom_outside.ts) | An intercom script allowing communication with another room running the [intercom_inside.ts](./examples/intercom_inside.ts) script.
[lock_inside.ts](./examples/lock_inside.ts) | A script that locks a door preventing others from using an exit in the room running the [lock_outside.ts](./examples/lock_outside.ts) script.
[lock_outside.ts](./examples/lock_outside.ts) | A script that prevents characters from using an exit locked by the script running the [lock_inside.ts](./examples/lock_inside.ts) script.
[lock_outside.ts](./examples/lock_outside.ts) | A script that prevents characters from using an exit locked by the [lock_inside.ts](./examples/lock_inside.ts) script.
[secret_exit.ts](./examples/secret_exit.ts) | A script that reveals a secret passage when the password "tapeworm" is spoken.
[vip_list.ts](./examples/vip_list.ts) | A script that manages a list of VIP characters, requested by another room running the [vip_guard.ts](./examples/vip_guard.ts) script.
[vip_guard.ts](./examples/vip_guard.ts) | A script that prevents characters from using an exit unless they are listed as VIP character by the [vip_list.ts](./examples/vip_list.ts) script.

## About

Expand Down
8 changes: 7 additions & 1 deletion devbin/devutils/docsconverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,16 @@ export default class DocsConverter {
* @return {string} Converted markdown.
*/
_convertToNamedHeaders(text, level = 0, idPrefix, headerCallback) {
let parentIds = [];
return text.replace(/^(#+)\s*(.*)/gm, (match, hashes, title) => {
title = title.trim();
const l = level + hashes.length;
const id = this._stringToId(title, idPrefix);
parentIds = parentIds.slice(0, l);
let id = this._stringToId(title, idPrefix);
id = l > 3 && parentIds[l - 1]
? parentIds[l - 1] + '-' + id
: id;
parentIds[l] = id;
headerCallback?.(title, hashes.length, id);
return `<h${l} id="${id}">${escapeHtml(title)}</h${l}>`;
});
Expand Down
Loading