aschrijver
(Arnold Schrijver)
2020 年5 月 21 日 07:50
1
I found this UI: Topic and Category Export/Import but that does not cover what I was thinking about:
A means to export an entire public or DM topic as a single markdown document where the export action is UI-accessible to all the participants in said topic.
And maybe (but for me not required) to have this feature available for anyone on public topics.
I interact with many Discourse forums publicly and DM’ingly and have a need to archive discussions there in a personal markdown-based knowledge base. This is not only very time-consuming, but I can’t get the raw markdown of other people’s posts in forums where I’m not mod or admin (logically), so I have to recreate it manually.
7 个赞
Stephen
(Stephen)
2020 年5 月 21 日 09:27
2
You can already access the raw markdown to topics:
Https://meta.discourse.org/raw/152185
2 个赞
aschrijver
(Arnold Schrijver)
2020 年5 月 21 日 10:04
3
Thanks, that would be so cool. But it only returns the first post in the topic and not the entire conversation thread.
Edit : More doable, by iterating over each post in the thread in raw mode, but for a thread with 60 posts still a lot of work. Furthermore it contains only the body of the post and there is no information on who posted, and when.
You can use the print function on a topic and save the output to a pdf. It is not markdown but it is easy!
1 个赞
aschrijver
(Arnold Schrijver)
2020 年5 月 22 日 05:10
5
Thank you, yes, I sometimes use that, but the content becomes ‘locked in’. It does not fit well with my knowledge base (create cross-links, etc.). Markdown is so simple and easy to work with, that I select all my tools around it. It is a great timesaver if you can just move MD snippets around all over the place.
2 个赞
Wall-E
(Raphael)
2021 年3 月 18 日 19:34
6
I was just asked that question yesterday. Are you referring to the print function of the browser? Or is there a Discourse feature to print the entire topic thread that I am not seeing?
Falco
(Falco)
2021 年3 月 18 日 19:38
7
2 个赞
oshyan
(Oshyan Greene)
2021 年8 月 14 日 04:43
8
Funny, I too would like something like this! So just another vote of support, I guess…
您好,
我刚在这里创建了一个账户,想说我也认为这种功能非常重要!
打印(到 PDF)目前在包含代码块的帖子中效果不佳,因为它们不会换行或扩展,所以内容会被裁剪。
我认为,例如出于存档目的,有一种可靠且相当简单的方法可以从 Discourse 中导出内容,这一点非常重要。
另一点需要考虑:我参加的一个论坛刚刚整合了许多来自已关闭邮件列表的用户——在关于是否保持邮件列表活跃或完全切换到论坛的过渡讨论中,一位失明成员表示,由于缺乏对基于文本的浏览器的支持,他们将无法参与论坛。我认为,一个带有作者署名和所有帖子的适当的原始模式将有助于更大的包容性。
2 个赞
让我们看看。我将在此处包含一个包含大量代码的代码块,看看它在打印时是什么样子:
import java.util.Scanner;
/**
* AceyDucey 游戏
* <p>
* 基于此处的 Basic AceyDucey 游戏
* https://github.com/coding-horror/basic-computer-games/blob/main/01%20Acey%20Ducey/aceyducey.bas
* 注意:目的是在 Java 中创建 1970 年代 Basic 游戏的版本,而不引入
* 新功能 - 未添加额外的文本、错误检查等。
*/
public class AceyDucey {
// 玩家当前现金金额
private int playerAmount;
// 第一个抽取的庄家牌
private Card firstCard;
// 第二个抽取的庄家牌
private Card secondCard;
// 玩家抽取的牌
private Card playersCard;
// 用于显示游戏介绍/说明
private boolean firstTimePlaying = true;
// 游戏状态,用于确定游戏是否结束
private boolean gameOver = false;
// 用于键盘输入
private final Scanner kbScanner;
// 扑克牌的常量值 - 2 为最低,14(A)为最高
public static final int LOW_CARD_RANGE = 2;
public static final int HIGH_CARD_RANGE = 14;
public AceyDucey() {
// 初始化玩家现金
playerAmount = 100;
// 初始化键盘扫描器
kbScanner = new Scanner(System.in);
}
// 重新开始方法 - 由调用游戏的类调用的公共方法
// 如果玩家输入 YES,则游戏可以重新开始(返回 true)
// 否则不能(返回 false)
public boolean playAgain() {
System.out.println();
System.out.println("抱歉,朋友,但你输光了。");
System.out.println();
System.out.println();
System.out.print("再玩一次(是或否) ");
String playAgain = kbScanner.next().toUpperCase();
System.out.println();
System.out.println();
if (playAgain.equals("YES")) {
return true;
} else {
System.out.println("好的,希望你玩得开心!");
return false;
}
}
// 游戏循环方法
public void play() {
// 持续玩牌局直到玩家现金耗尽
do {
if (firstTimePlaying) {
intro();
firstTimePlaying = false;
}
displayBalance();
drawCards();
displayCards();
int betAmount = getBet();
playersCard = randomCard();
displayPlayerCard();
if (playerWon()) {
System.out.println("你赢了!!");
playerAmount += betAmount;
} else {
System.out.println("抱歉,你输了");
playerAmount -= betAmount;
// 玩家钱输光了?
if (playerAmount <= 0) {
gameOver = true;
}
}
} while (!gameOver); // 持续玩直到玩家现金耗尽
}
// 确定玩家是否获胜(返回 true)或失败(返回 false)的方法
// 要获胜,玩家的牌必须在庄家前两张牌的值范围内
// 包括第一张和第二张牌。
private boolean playerWon() {
// 赢家
return (playersCard.getValue() >= firstCard.getValue())
&& playersCard.getValue() <= secondCard.getValue();
}
private void displayPlayerCard() {
System.out.println(playersCard.getName());
}
// 获取玩家的赌注,并返回金额
// 0 被认为是有效赌注,但超过玩家可用金额的赌注无效
// 方法将循环直到输入有效的赌注。
private int getBet() {
boolean validBet = false;
int amount;
do {
System.out.print("你的赌注是多少? ");
amount = kbScanner.nextInt();
if (amount == 0) {
System.out.println("胆小鬼!!");
validBet = true;
} else if (amount > playerAmount) {
System.out.println("抱歉,我的朋友,但你赌的太多了。");
System.out.println("你只有 " + playerAmount + " 美元可以下注。");
} else {
validBet = true;
}
} while (!validBet);
return amount;
}
private void displayBalance() {
System.out.println("你现在有 " + playerAmount + " 美元。");
}
private void displayCards() {
System.out.println("这是你的下一张牌:");
System.out.println(firstCard.getName());
System.out.println(secondCard.getName());
}
// 抽取两张庄家牌,并保存以备后用。
// 确保第一张牌的值小于第二张牌
private void drawCards() {
do {
firstCard = randomCard();
secondCard = randomCard();
} while (firstCard.getValue() >= secondCard.getValue());
}
// 创建一张随机牌
private Card randomCard() {
return new Card((int) (Math.random()
* (HIGH_CARD_RANGE - LOW_CARD_RANGE + 1) + LOW_CARD_RANGE));
}
public void intro() {
System.out.println("ACEY DUCEY 纸牌游戏");
System.out.println("CREATIVE COMPUTING 新泽西州莫里斯敦");
System.out.println();
System.out.println();
System.out.println("ACEY-DUCEY 的玩法如下:");
System.out.println("庄家(计算机)发出两张面朝上的牌");
System.out.println("你可以选择下注或不下注,取决于");
System.out.println("你是否认为下一张牌的值会");
System.out.println("介于前两张牌之间。");
System.out.println("如果你不想下注,请输入:0");
}
}
请注意,我们拥有相当完整的可访问性支持,因此我很想知道您的盲人用户 @thresholdpeople 具体有哪些功能不起作用。
另外,在我看来,上面的代码块在打印版本中看起来不错。我刚刚在 Chrome 中按了“打印”,然后按了“另存为 PDF”,以生成此主题的 PDF 版本:
将主题导出为 markdown - 功能 - Discourse Meta.pdf (249.9 KB)
我没有看到问题。如果您确实看到了问题,请指出 PDF 中的具体区域。谢谢!
感谢您对此事的关注。
我正在使用 Vivaldi,但也用过 Chrome,在不同的电脑上,并非所有电脑都同步了浏览器设置,但当我打印时,您的代码块会在以下位置被裁剪:
// Players drawn card
private Card playersCard;
这也是我在内联查看帖子时能看到的所有内容(我必须在代码框内向下滚动才能看到更多内容)。我可以发布我的版本,但没有足够的帖子来上传文件,不过您应该明白我的意思。
您的打印版本看起来确实更好,但说实话,我不确定为什么会有所不同,它也不是完美的。代码行不换行,因此被裁剪了,而且所有页面左下角都有一个浮动的蓝色矩形,这也遮挡了一些文本。不幸的是,在这种状态下,它也无法真正使用。
SuperCollider 论坛上有人提供了一个解决方案,就是将以下 CSS 块粘贴到浏览器的检查器中,或者在使用浏览器插件时(我现在有 Chrome 扩展 Stylish,它会在我访问该论坛时自动添加它):
pre code {
white-space: pre-wrap;
max-height: none;
background: #fafafa;
}
使用这个方法,打印对我来说效果很好。而且有了浏览器扩展,每次我想保存东西时就不需要进去麻烦地添加它了,这才是真正的解决方案……否则太麻烦了。
尽管如此,我还是希望有更简单的方法来存档帖子,或者说,我希望有一种方法可以不必采取这些额外的步骤。
尤其是因为大部分功能已经存在:无论是查看原始帖子还是打印。但是的,无法在原始状态下看到整个帖子,只能看到单个帖子,而且打印效果不太好。
话虽如此,书签是一个很棒的论坛功能,我一直都在使用它们,但它仍然将所有内容都保留在 discourse 中。
1 个赞
我们可以添加一个返回整个主题的原始 @falco 的路由吗?这可能很有用,尽管我们需要小心处理大型主题……
我们肯定已经为单个帖子提供了这个功能,例如:
https://meta.discourse.org/raw/152185/12
3 个赞
Falco
(Falco)
2022 年1 月 14 日 18:54
13
这当然是可行的,尽管这是一个相当小众的用例。
格式将是这样的:
用户名 | 时间戳 | 帖子编号
帖子正文
---
用户名 | 时间戳 | 帖子编号
帖子正文
---
用户名 | 时间戳 | 帖子编号
帖子正文
2 个赞
是的,我支持它。如果我们有一个帖子的 /raw/ 路由,为什么不能有一个主题的路由呢?
2 个赞
Falco
(Falco)
2022 年1 月 14 日 19:06
15
2 个赞
Falco
(Falco)
2022 年1 月 17 日 22:42
18
8 个赞